JS client for E-Com Plus REST APIs
TL;DR: We have methods to run requests for almost all E-Com Plus APIs, but you're probably searching for Store API.
The @ecomplus/client
package provides a list of methods, each one is a function to request a specific E-Com Plus REST API, using axios HTTP client and returning a Promise.
It's available for both Node.js and browser environments.
import { store } from '@ecomplus/client'
const authenticationId = 'myAuthenticationId'
const accessToken = 'myAccessToken'
ecomClient.store({
url: '/products.json',
authenticationId,
accessToken,
method: 'post',
data: { sku: '123', name: 'Sample Prduct 123' }
})
.then(({ data, status }) => console.log(status, data))
.catch(error => console.error(error))
It requires and may not include core-js
, axios
and @ecomplus/utils
.
npm i --save @ecomplus/utils @ecomplus/client
npm i --save core-js @ecomplus/utils @ecomplus/client
<script src="https://cdn.jsdelivr.net/npm/@ecomplus/client/dist/ecom-client.polyfill.min.js"></script>
axios
and ecomUtils
libraries must be included separately and available on window scope.
Fork/clone this repository and install dependencies normally:
git clone https://github.com/ecomplus/client
cd client
npm i
Then you can edit source files and test locally with npm run serve
.
Please read the contribution guidelines.
Take a look on package.json
scripts:
npm run doc
- Update jsdoc/docdash generated documentation;npm run release
- Generate changelog and new version;