npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pingdom-api

v1.0.0

Published

Pingdom API client

Downloads

15

Readme

pingdom-api - Pingdom API for Node.js

pingdom-api provides a simple, programmatic access to Pingdom's API and simplifies its usage somewhat.

Circle CI

Authenticate

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 login
    pass: 'edit this',  // user account password
    appkey: 'edit this' // pingdom application key
    //accountEmail: 'optional' // the account on which to perform the request (optional)
});

get[resourceName](options, [callback]);

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.

Example:

pingdomApi.getChecks({
  target: 'someCheckId',
  qs: {
    limit: 10
  }
}, function (err, checks, response){
  console.log(err, checks);
});

or

pingdomApi.getChecks()
.spread(function(checks, response){
  console.log(checks, response);
})
.catch(function(e){
  console.log(e);
});

set[resourceName](options, [callback]);

All of the POST endpoints can be accessed using methods which follow the same syntax as the aforementioned GET methods.

update[resourceName](options, [callback]);

All of the PUT endpoints can be accessed using methods which follow the same syntax as the aforementioned GET methods.

remove[resourceName](options, [callback]);

All of the DELETE endpoints can be accessed using methods which follow the same syntax as the aforementioned GET methods.


LEGACY DOCS (STILL WORK)

Consider the example below:

var pingdom = require('pingdom-api');

var credentials = {
    user: 'updatethis', // based on your user account
    pass: 'updatethis', // based on your user account
    appkey: 'updatethis' // generated per app via web interface
}
var api = pingdom(credentials);

api.checks(function(err, checks) {
    if(err) return console.error(err);

    console.log('received checks', checks);

    // get some results
    api.results(function(err, results) {
        if(err) return console.error(err);

        console.log('received results', results);
    }, {
        target: checks[0].id,
        qs: { // based on https://www.pingdom.com/services/api-documentation-rest/#ResourceResults
            limit: 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.

Contributors

License

pingdom-api is available under MIT. See LICENSE for more details.