HPE's Operations Orchestration client API module for NodeJS
Install the API module as a depdency in your project so you can easily use it to query Operations Orchestration REST API
npm install operations-orchestration-api --save
-
Require the module
var OO = require('operations-orchestration-api');
-
Create an options object with the
username
, andpassword
that are allowed to query the REST API, as well as thebaseUrl
property for the full URL where the OO REST API is availablevar options = { username: 'admin', password: 'admin', baseUrl: 'http://localhost:8050/oo/rest/v1' };
-
Initialize the OO object with the options
OO.setClient(options);
After the OO module is initialized with the correct options, we can begin querying information.
The following example will query for the statistics, and you can inspect the err
or data
object for the returned result.
try {
const data = await OO.dashboard.statistics(); // Throws err if Promise got rejected
console.log(data);
} catch (err) {
console.log(err);
}
The data
object will contain an array of objects with all the config-items set in OO
try {
const data = await OO.config.getAllItems(); // Throws err if Promise got rejected
console.log(data);
} catch (err) {
console.log(err);
}
Version 2.x has been updated to employ Promises functionality based on async/await, and as such requires a current Node.js release.
Version compatibility matrix for this library:
OO API Library version | Node.js support | Comments |
---|---|---|
v1.x | Node.js 4.x, 5.x, 6.x, 7.x | based on callbacks, for example: OO.dashboard.statistics(function(err, data) { console.log(data); }); |
v2.x | Node.js >= 7.8.x |
Liran Tal liran.tal@gmail.com