0.9.1 • Published 4 years ago

rdgkb-json v0.9.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

RDG Knowledgebase APIs (rdgkb-json)

This is a node module that will interface to RDG's Knowledgebase static data API's, see the link below for more details

It is designed to deliver the XML data returned by the API in JSON format.

A compressed PDF for the various feed specs is available here

NB: This is pre-release software

Using the module

The first step is to install the module into your node project

  • npm install -s rdgkb-json

Then to test just do the following

/**
 * Simple example code for accessing the RDG incidents API
 * NB: You will need a valid username and password
 */
const RDGKnowledgebaseAPI = require('./index');
const username = "abc@123.a"; // put a valid username here
const password = "invalidpassword" // put a valid password here


// Create the API
const api = new RDGKnowledgebaseAPI(username, password);

// validate the credentials used
api.logon().then(result => {
  if(!result) {
    console.log(api.error);
  } else {
    api.callAPI(api.methods.INCIDENTS).then(data => {
      console.log(data);
    });
  }
});