Skip to content

maks/node-matrix-jsapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Squiz Matrix JSAPI ported to Nodejs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published