Announcing a node.js client library for the Dashboard API

tejashah88
Conversationalist

Announcing a node.js client library for the Dashboard API

Hey guys,

 

I've been working on a client library to interact with the Dashboard API from node.js called 'node-meraki-dashboard'. It's fairly simple to use, is promised based, and all endpoints as of June 2018 have been implemented. Check it out here: https://github.com/tejashah88/node-meraki-dashboard. If you have any feature suggestions or bugs, please create a GitHub issue.

 

Here are some examples to get started:

 

Using Promises:

var dashboard = require('node-meraki-dashboard')(apiKey);
dashboard.organizations.list()
  .then(data => console.log(data))
  .catch(error => console.log(error));

Using async/await (node 8+)

var dashboard = require('node-meraki-dashboard')(apiKey);

(async function() {
  try {
    var orgList = await dashboard.organizations.list();
    console.log(orgList);
  } catch (error) {
    console.log(error);
  }
})();

 

5 Replies 5
PhilipDAth
Kind of a big deal
Kind of a big deal

OMG!  What an excellent job!

PhilipDAth
Kind of a big deal
Kind of a big deal

@tejashah88 I've been using your node.js library this week.  I love it.  It works really well.

PhilipDAth
Kind of a big deal
Kind of a big deal

@tejashah88 , I'm having problems with the camera snapshot API.

 

If I use this code to get a videoLink it works,

 

dashboard.cameras.videoLink(netID, cameraSerial, ts)
.then(data => processPerson(data))
.catch(error => console.log("snaptshot error: "+error));

 

If I use this code to get a snapshot (what I really want):

dashboard.cameras.snapshot(netID, cameraSerial, ts)
.then(data => processPerson(data))
.catch(error => console.log("snaptshot error: "+error));

 

I get this error being thrown:

"snaptshot error: TypeError: Cannot convert undefined or null to object"

 

In both cases both API calls have exactly the same parameters, so I'm pretty sure they are correct.  I have also tried removing the "ts" (timestamp) parameter but I still get the same error.

tejashah88
Conversationalist

@PhilipDAth Thanks for bringing this to my attention. For everyone else, to summarize the discussion from here, there's a bug in the HTTP library axios where calling a POST request for a url that results in a redirect will change the request operation to a GET. You can follow more of this discussion here.

PhilipDAth
Kind of a big deal
Kind of a big deal

Have you had a chance to fix the issue yet?  I don't think axios is going to be changed. 

Get notified when there are additional replies to this discussion.