Squiz Matrix JSAPI ported to Nodejs
JavaScript Shell
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
tests
.gitignore
LICENSE.txt
README.textile
nlogger.json
package.json

README.textile

Squiz Matrix JSAPI ported to Nodejs

Author: Maksim Lin <maks@manichord.com>

Installation

The easiest way is to install using NPM:

npm install node-matrix-jsapi

Usage

See the Squiz Matrix manual
for information regarding using the JSAPI.

In addition to the function call to set the API Key described in the manual above,
there are extra functions that need to be called to set the URL, matrix username and
password prior to any calls being made to the API.

e.g.

var mapi = require('../lib/matrix-api');
    mapi.setApiKey(API_KEY);
    mapi.setApiUrl(API_URL);
    mapi.setUsername(API_USER);
    mapi.setPassword(API_PASSWORD);
    mapi.createAsset(
    etc...

Please note that the callback function supplied to all the methods will return an error (if any) as the first parameter,
and the results in the second. This is DIFFERENT from the behaviour of the original JSAPI within Matrix but better matches
the conventions used in NodeJS.

e.g.

 mapi.createAsset(..., function(err, result) { log.console('created AssetID:'+result.id);} );

Testing

Prior to running the test cases please make sure you have created JSAPI asset in your Matrix instance and entered its API Key and URL into the test file. You will also need to make sure that you have:

  • Enabled the Matrix setting: Process PHP Credentials: YES
  • Have a Matrix Backend user asset created with permissions to the parent asset under which you will create the test assets

License

GPL v2