Giter Club home page Giter Club logo

node-meraki-dashboard's People

Contributors

dhanush123 avatar tejashah88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-meraki-dashboard's Issues

2 New Group Policy API endpoints

Missing API endpoint

  • DELETE /networks/{networkId}/groupPolicies/{groupPolicyId}

link


Congrats by the way. This is the best Meraki API Client that I've come across, based on implemented API calls and code readability.

All APIs that use post are broken

All APIs that use rest.post (aka a POST request to the Meraki API as opposed to a GET request) fail with a "TypeError: Cannot convert undefined or null to object" error.

A sample API to reproduce the problem is:
dashboard.devices.reboot("L_610800699462******","--****");

I have tracked the issue down to a bug in axios.
axios/axios#2460
Basically if you do a POST and the server redirects axios is incorrectly changing it to a GET request.

To further confirm the issue if you modify the base URL from https://api.meraki.com/api/v0/ to the URL of the shard that the organisation is hosted on the issue does not happen.

Apart from the axios bug what this reveals is each API call is probably taking almost twice as long as they could due to network latency. First axios makes a request to api.meraki.com, gets a redirect, and then makes the call again to the shard URL.

Any potential fix needs to be carefull to make sure it still works when using multiple organisations at the same time.

Add testing/coverage

  • Add unit tests
  • Add API coverage (experimental)
  • Add Travis CI integration
  • Add coveralls.io integration

Implement recently added new API endpoints

The Meraki Dashboard API has recently been receiving a bunch of new updates to some of their endpoints, as well as new categories to the endpoints.

New categories:

  • Hotspot 2.0 (Only available in the Meraki DevNet Sandbox)
  • MX VPN firewall
  • MX cellular firewall
  • Phone callgroups

Updated categories:

  • Devices
  • SM

dashboard.devices.update - does not update

Hi

Im not sure why but i can not update devices with the dashboard.devices.update function.
I do not get back an error, it just sends back the original object from the meraki api.

So my snippet goes like that:

`
params = {"name":"New Name", "lat":99.4180951010323, "lng":-99.098531723022, "serial":"QXXX-XXXX-XXXX", "mac":"XX:XX:XX:XX:XX:XX", "tags":" recently-added tag1 tag2 "};
console.log(JSON.stringify(params));

                            dashboard.devices.update(network_id, serial, params)
                                    .then(function(data) { console.log(data) })
                                    .catch(function(error) { console.log(error)});

Answer is like:
{"lanIp":"192.168.128.4","serial":"XXXX-XXXX-XXXX","mac":"XX:XX:XX:XX:XX:XX","lat":99.4180951010362,"lng":-99.098531723022,"address":"old","tags":" recently-added ","name":"Your AP","model":"MR32","networkId":"L_671036344471234567"}
`

If i put the params with Postmaster i get back the updated object.

So is anybody having the same issue?

index.js missing

I tried to use the npm package, which does not work as described in the README. The problem is that there is no index.js in the main folder instead it is in the src folder. However node won't find it there, you have to write require("node-meraki-dashboard/src/index.js") to get it working. So you have to add a index.js into the main folder which exports the one in the src folder or change the "main" field in the package.json to "src/index.js".

API coverage error?

Was unable to run the API coverage tool, had an unhandled promise error. Followed the setup & testing exactly, but some tests failed.

[bogdanvisan node-meraki-dashboard (master)]$ npm test

> [email protected] test /Users/bogdanvisan/node-meraki-dashboard
> mocha test/**/*.js



  utils/code-analyzer.js
    ✓ should have a defined method and path

  utils/retrieve-api-routes.js
    retrieving API endpoints
      1) should successfully retrieve the official API docs
    testing structure of retrieved resources
      official documentation
        2) should have the following fields: [group, path, has_params, method, description, alt_path, params]

  basic structure of client library
    ✓ should have a constructor that is a normal function
    ✓ should return an object when you initialize it
    ✓ should fail if not given anything (null or undefined) for the api key
    ✓ should fail if not given a string for the api key
    ✓ should fail if given a string with various whitespace

  code structure analysis tests
    ✓ should have valid REST methods implemented
    ✓ should have the path formed properly, with path parameters isolated from normal words


  8 passing (1s)
  2 failing

  1) utils/retrieve-api-routes.js
       retrieving API endpoints
         should successfully retrieve the official API docs:
     AssertionError: expected promise to be fulfilled but it was rejected with 'SyntaxError: Unexpected token \' in JSON at position 1'
      at assertIfNotNegated (node_modules/chai-as-promised/lib/chai-as-promised.js:68:19)
      at /Users/bogdanvisan/node-meraki-dashboard/node_modules/chai-as-promised/lib/chai-as-promised.js:101:17
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at async Promise.all (index 0)

  2) utils/retrieve-api-routes.js
       testing structure of retrieved resources
         official documentation
           should have the following fields: [group, path, has_params, method, description, alt_path, params]:
     AssertionError: expected promise to be fulfilled but it was rejected with 'SyntaxError: Unexpected token \' in JSON at position 1'
      at assertIfNotNegated (node_modules/chai-as-promised/lib/chai-as-promised.js:68:19)
      at /Users/bogdanvisan/node-meraki-dashboard/node_modules/chai-as-promised/lib/chai-as-promised.js:101:17
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at async Promise.all (index 0)



npm ERR! Test failed.  See above for more details.

Tried to run api-coverage:

[bogdanvisan node-meraki-dashboard (master)]$ npm run api-coverage

> [email protected] api-coverage /Users/bogdanvisan/node-meraki-dashboard
> node ./tools/api-coverage.js

Fetching endpoints...
(node:88566) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token ' in JSON at position 1
    at JSON.parse (<anonymous>)
    at /Users/bogdanvisan/node-meraki-dashboard/utils/retrieve-api-routes.js:16:35
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:88566) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:88566) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[bogdanvisan node-meraki-dashboard (master)]$ 

I added this bit to get some more info in the utils/retrieve-api-routes.js

process.on('unhandledRejection', (reason, p) => {
  console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
});

I received this error which had more detail

[bogdanvisan node-meraki-dashboard (master)]$ npm run api-coverage

> [email protected] api-coverage /Users/bogdanvisan/node-meraki-dashboard
> node ./tools/api-coverage.js

Fetching endpoints...
Unhandled Rejection at: Promise Promise {
  <rejected> SyntaxError: Unexpected token ' in JSON at position 1
      at JSON.parse (<anonymous>)
      at /Users/bogdanvisan/node-meraki-dashboard/utils/retrieve-api-routes.js:20:35
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
} reason: SyntaxError: Unexpected token ' in JSON at position 1
    at JSON.parse (<anonymous>)
    at /Users/bogdanvisan/node-meraki-dashboard/utils/retrieve-api-routes.js:20:35
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
[bogdanvisan node-meraki-dashboard (master)]$ 

Tried to troubleshoot, looks like semiOfficial has this result. Unfortunately could not get very far :(

[
  "['PUBHUB_CONTENT_URL']",
  "['PUBHUB_URL_PREFIX']",
  "['PUBHUB_TYPE']",
  "['MetaDataAPI']",
  "['AUTH_URL']"
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.