Skip to content

Latest commit

 

History

History
98 lines (81 loc) · 3.12 KB

README.md

File metadata and controls

98 lines (81 loc) · 3.12 KB

Magento SOAP API Wrapper

This wrapper lets you talk to Magento via SOAP.

Why this fork?

We forked the original repository (which is actually a fork itself) in order to allow specifying HTTP authentication parameters when creating a connection.

Installation

npm install git+https://github.com/swishlabsco/magentoapi.git

Usage

var MagentoAPI = require('magento-nodejs');
var magento = new MagentoAPI({
  host: 'your.host',
  port: 80,
  path: '/api/xmlrpc/',
  login: 'your_username',
  pass: 'your_pass',
  basicAuth: { // optional
    user: 'basic_auth_username',
    pass: 'basic_auth_password'
  }
});

magento.login(function(err, sessId) {
  if (err) {
    // deal with error
    return;
  }

  // use magento
});

If an HTTPS connection is needed:

var magento = new MagentoAPI({
  host: 'your.host',
  port: 443,
  path: '/api/xmlrpc/',
  login: 'your_username',
  pass: 'your_pass',
  secure: true,
  basicAuth: { // optional
    user: 'basic_auth_username',
    pass: 'basic_auth_password'
  }
});

If need be, you can manually change the session id:

magento.changeSession(newSessionId);

All of the API methods take an object of params as the first argument, and a callback as the second.

Or, if no params are sent, just a callback as the first argument.

Methods