magento2
v0.0.2
Published
Consume Magento 2 REST API
Downloads
5
Readme
Consume Magento 2 REST API
Currently a work in progress.
Wrapper for connecting to Magento 2 REST API.
Example Usage
This uses restler as a HTTP Client library, please see their documentation for more examples/sample usage.
var Magento2Api = require('magento2');
magento = new Magento2Api({
url: 'http://example.com', // without trailing slash
username: 'username',
password: 'password'
});
magento.get('categories').on('complete', function(result) {
if (result instanceof Error) {
console.log('Error:', result.message);
this.retry(5000); // try again after 5 sec
} else {
console.log(result);
}
});
Options
| Option | Type | Required | Description |
| ---------------- | ---------- | -------- | -------------------------------------------------------------------- |
| url
| String
| yes | Your Store URL, example: http://example.com (without trailing slash) |
| username
| String
| yes | Your API username |
| password
| String
| yes | Your API password |
| version
| Interger
| no | API version, default is 1
|
| encoding
| String
| no | Encoding, default is 'utf-8' |
End points
For a complete list of endpoints see:
- http://devdocs.magento.com/guides/v2.0/rest/list.html
- http://devdocs.magento.com/swagger/index.html
Those implemented in this module:
- [ ] Backend #1
- [ ] Bundle #2
- [ ] Catalog #3
- [ ] CatalogInventory #4
- [ ] Checkout #5
- [ ] CheckoutAgreements #6
- [ ] ConfigurableProduct #20
- [ ] Cms #7
- [ ] Customer #8
- [ ] Directory #9
- [ ] Downloadable #10
- [ ] Eav #11
- [ ] GiftMessage #12
- [ ] Integration #13
- [ ] Quote #14
- [ ] Sales #15
- [ ] SalesRule #16
- [ ] Search #19
- [ ] Store #17
- [ ] Tax #18