linnjs
v0.0.2
Published
wrapper for linnworks api
Downloads
4
Readme
linnJS - A simple interface for interacting with the Linnworks API
The linnworks api, as documented here, is a great resource. This library is meant to abstract away some of the difficulties in using the API from a node.js application.
All it does right now is initalize the connection for you and provide you with a Promise-based interface for sending post
requests to the server.
Install by npm install linnjs
.
This is how you might use it:
var linnJS = require('linnJS');
linnJS.initialize(process.env.linnworksusername, process.env.linnworkspw)
.then(function(api){
// this is where the magic happens
api.post('ImportExport/AreExportsEnabled')
.then(function(response){
console.log(response); // will print false or true
});
})
.catch(function(err){
console.log(err);
});
After the connection with the API is initialized, simply call api.post
with 2 arguments: the API method you wish to call, and an object with any data that you want to post to that method.
The example above, api.post('ImportExport/AreExportsEnabled')
, is how you'd call this method.
Here's an example where you'd have to post some data as well (for this method):
api.post('ImportExport/EnableExports', {enable:true});