Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including jspagerduty with all npm packages installed. Try it out:

var jspagerduty = require("jspagerduty")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

jspagerduty v1.0.6

Javascript PagerDuty API

jsPagerDuty

jsPagerDuty is a Javascript module for working with the PagerDuty API insipired by Caian Ertl.

Requirements

  • Tested against PagerDuty REST API v2
  • For Node.js you will need the xmlhttprequest library.

Documentation

Getting Started

If you are using Node.js, install jsPagerDuty using npm:

$ npm install jspagerduty

You can now require and use jspagerduty like so:

let PagerDutyAPI = require('jspagerduty')

const PAGERDUTY_EMAIL = process.env.PAGERDUTY_EMAIL
const PAGERDUTY_TOKEN = process.env.PAGERDUTY_TOKEN

let pdapi = new PagerDutyAPI(PAGERDUTY_EMAIL, PAGERDUTY_TOKEN)

pdapi.listIncidents({statuses: ['triggered'], include: ['users','services','priorities']}).then((data) => {
    console.log(data)
})

pdapi.getUser('PQ6ASX3', {include: ['contact_methods','teams','notification_rules']}).then((data) => {
    console.log(data)
})

Refer to the PagerDuty API Documentation and the jsPagerDuty Examples for more information.

Browser

You can also load this script on your browser like so:

<script src='https://cdn.jsdelivr.net/npm/jspagerduty/jsPagerDuty.js'></script>

You can now use the class PagerDutyAPI normally on the page, like you would on Node.js.

License

jsPagerDuty - PagerDuty API Javascript Library.
Copyright (C) 2019  Guilherme Caulada (Sighmir)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free