Package Exports
- magento2-js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (magento2-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
magento2-js
A Node.JS module, which provides an object oriented wrapper for the Magento v2 Rest API.
☁️ Installation
# Using npm
npm install --save magento2-js
# Using yarn
yarn add magento2-js📋 Example
const {Magento2Client} = require('magento2-js');
const options = {
url: 'http://www.test.com/index.php/rest',
consumerKey: '<OAuth 1.0a consumer key>',
consumerSecret: '<OAuth 1.0a consumer secret>',
accessToken: '<OAuth 1.0a access token>',
accessTokenSecret: '<OAuth 1.0a access token secret>',
};
const client = Magento2Client(options);
const stores = await client.stores.list();