jmc

js-magento-client

Magento javascript client for node.js

Showing:

Popularity

Downloads/wk

22

GitHub Stars

2

Maintenance

Last Commit

4yrs ago

Contributors

0

Package

Dependencies

1

Size (min+gzip)

4.9KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

js-magento-client

Magento javascript client for node.js using ES6 class

install

npm install js-magento-client

Usage

Login Api

import {MagentoAccountApi} from 'js-magento-client';
import expect from 'expect';

let url = 'magento-url';
let username = 'username';
let password = 'password';

MagentoAccountApi.loginAsClient(
      url, 
      username, 
      password)
      .then((response) => {
        let token = response.data;
        expect(response.status).toEqual(200);
        expect(token.length).toBeGreaterThan(0);
        done();
      }).catch(reason => {
        console.log(reason);
        done(new Error(reason));
      });

Root Category Api

import {MagentoCategoryApi} from 'js-magento-client';
import expect from 'expect';

let url = 'magento-url';

MagentoCategoryApi.loadRootCategory(url).then(response => {
   let rootCategory = response.data;
   expect(rootCategory.children_data.length).toBeGreaterThan(0);
   done();
}).catch(reason => {
   console.log(reason);
   done(new Error(reason));
});

Load Products in a particular category

import {MagentoCategoryApi} from 'js-magento-client';
import expect from 'expect';

let categoryId = 19;
let url = 'magento-url';

MagentoCategoryApi.loadProducts(url, categoryId).then(response => {
   //console.log(response.data);
   expect(response.data.length).toBeGreaterThan(0);
   done();
}).catch(reason => {
   console.log(reason);
   done(new Error(reason));
})

Load Product by SKU

import {MagentoProductApi} from 'js-magento-client';
import expect from 'expect';

let sku = 'product_dynamic_17';
let url = 'magento-url';

MagentoProductApi.loadProduct(url, sku).then(response => {
   let product = response.data;
   console.log(product);
   done();
}).catch(reason => {
   console.log(reason);
   done(new Error(reason));
});

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100