The official Strapi SDK for JavaScript
npm install strapi-sdk-javascript⚠️ This package not up to date and maintained ⚠️
We recommend you not to use this package. We stopped to maintained it by lack of time and also because the features provided by this SDK are the same as a good HTTP client well configured.
So I suggest you use the best HTTP client for the technology you use. To configure it to target your Strapi API.
Here so usefull ressources to help you:
- API Endpoints
- URL parameters
---

---
``sh`
npm install strapi-sdk-javascript
js
import Strapi from 'strapi-sdk-javascript';const strapi = new Strapi('http://localhost:1337');
`$3
#### Local
`js
await strapi.login('username_or_email', 's3cr3t');
`#### Providers
`js
// Redirect your user to the provider's authentication page.
window.location = strapi.getProviderAuthenticationUrl('facebook');
`
Once authorized, the provider will redirects the user to your app with an access token in the URL.
`js
// Complete the authentication: (The SDK will store the access token for you)
await strapi.authenticateProvider('facebook');
`
You can now fetch private APIs
`js
const posts = await strapi.getEntries('posts');
`$3
#### Browser
`js
const form = new FormData();
form.append('files', fileInputElement.files[0], 'file-name.ext');
form.append('files', fileInputElement.files[1], 'file-2-name.ext');
const files = await strapi.upload(form);
`#### Node.js
`js
const FormData = require('form-data');
const fs = require('fs');
const form = new FormData();
form.append('files', fs.createReadStream('./file-name.ext'), 'file-name.ext');
const files = await strapi.upload(form, {
headers: form.getHeaders()
});
``#### requestConfig
Custom axios request configuration. See documentation
* Documentation
* Changelog
* Medium story
* GraphQL
* Attach/Detach entry relationship
* Real time with Socket.io
MIT