Pingdom API client
pingdom-api provides a simple, programmatic access to Pingdom's API and simplifies its usage somewhat.
To authenticate with the module, you must provide your pingdom credentials when initializing. You can also provide the field "accountEmail," which will allow for multi-user auth.
var pingdomApi = require'pingdom-api'user: 'edit this' // user account loginpass: 'edit this' // user account passwordappkey: 'edit this' // pingdom application key//accountEmail: 'optional' // the account on which to perform the request (optional);
All of the GET endpoints can be accessed using methods which have the following camelCase syntax:
getChecks (where Checks is the name of the endpoint reference). If there is a "." in the original reference name, it becomes camelCase. For example, getSummaryPerformance();
All endpoint methods are callback/promise compatible. To pass querystring options (per the pingdom API), simply add an object called "qs" with the necessary options. If the endpoint calls for a parameter, pass this in using the "target" field in options.
pingdomApigetCheckstarget: 'someCheckId'qs:limit: 10console.logerr checks;;
All of the POST endpoints can be accessed using methods which follow the same syntax as the aforementioned GET methods.
Consider the example below:
var pingdom = require'pingdom-api';var credentials =user: 'updatethis' // based on your user accountpass: 'updatethis' // based on your user accountappkey: 'updatethis' // generated per app via web interfacevar api = pingdomcredentials;apichecksiferr return console.errorerr;console.log'received checks' checks;// get some resultsapiresultsiferr return console.errorerr;console.log'received results' results;target: checks0idqs: // based onlimit: 100;;
Currently the API provides access just read-only access to Pingdom's API. In case you need something else, either poke me with an issue or create a pull request.
- rwky - Handling of irregular parts of the API
- Kevin Moritz - Massive improvements (promise-based API, basic tests, cleanup)
pingdom-api is available under MIT. See LICENSE for more details.