Coder Social home page Coder Social logo

alexlessard / statuspage-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dyninc/statuspage-api

0.0 1.0 0.0 23 KB

A Node JS package to interact with select StatusPage.io API elements.

License: MIT License

Makefile 3.88% JavaScript 96.12%

statuspage-api's Introduction

npm version license badge

statuspage-api

GET and POST for select StatusPage.io API elements.

Installation

npm install statuspage-api

Usage

var StatusPageAPI = require('statuspage-api');
// Or for local example:
// var StatusPageAPI = require('../../statuspage-api');

/*
 * Initialize object
 */
var statuspage = new StatusPageAPI({
  pageid: "<ADD YOUR OWN PAGE ID>",
  apikey: "<ADD YOUR OWN API KEY>",
  host: "api.statuspage.io",      // Override the default host
  port: 443,                // Override the default port
  // useragent: "statuspage-node",  // Override the default useragent
  debuglevel: "warn"      // Set debug levele: debug, info, warn, error
});

/*
 * Define callback to print API result
 */
var printAll = function(result) {
  console.log("Status: ", result.status);
  if (result.error != null) {
    console.log("Error: ", result.error);
  }
  if (result.status == "success"){
    console.log("Data: ", result.data);
  }
}

/*
 * GET page contents using printAll callback
 */
 statuspage.get("pages", printAll);

/*
 * POST a scheduled incident and print the result
 */
var args = {
    "incident[name]": "Testing API components",
    "incident[status]": "scheduled",
    "incident[scheduled_for]":  "2015-04-03T18:30:05+00:00",
    "incident[scheduled_until]": "2015-04-03T18:35:05+00:00",
    "incident[message]": "This is only a test.\n Really, it's only a test.",
    "incident[scheduled_remind_prior]": "t",
    "incident[scheduled_auto_in_progress]": "t",
    "incident[scheduled_auto_completed]": "t",
    "incident[impact_override]": "minor",
    "incident[component_ids]": ["tblsw29xd923","tvb8cjnr022n"]
}
statuspage.post("incidents", args, printAll);

For more information see example

Supported calls:

Accepts a subset of StatusPage.io collections or elements.

  • GET

    • pages
    • components
    • incidents, incidents/unresolved, incidents/scheduled
    • subscribers
  • POST:

    • incidents
    • subscribers

Read more about the statuspage.io API here

Influences

Heavily drawn from jammus's lastfm-node and DynectEmail-Node

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.