tijsverkoyen / node-zebrix-client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zebrix for Node.js

An client library for the Zebrix REST.

let Zebrix = require('node-zebrix-client');

let client = new Zebrix({
    client: process.env.ZEBRIX_CLIENT,
    username: process.env.ZEBRIX_USERNAME,
    password: process.env.ZEBRIX_PASSWORD
});

client.login(function (data, error) {
    // set the token
    client.options.token = data.token;
    
    // list the datasources
    client.get('api/datasource', function(data, error) {
        console.log(data);
    });
});

Installation

npm install node-zebrix-client

Run tests

This test suite connects to the real API, so no mocking.

ZEBRIX_CLIENT=xxxx ZEBRIX_USERNAME=yyyy ZEBRIX_PASSWORD=zzz npm run test

Requests

You now have the ability to make GET and POST requests against the API via the convenience methods.

client.get(path, body, callback);
client.post(path, body, callback);

About


Languages

Language:JavaScript 100.0%