Socket
Socket
Sign inDemoInstall

@pagerduty/pdjs

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pagerduty/pdjs

A new simple JavaScript wrapper for the PagerDuty API


Version published
Maintainers
4
Created

What is @pagerduty/pdjs?

@pagerduty/pdjs is an npm package that provides a JavaScript client for interacting with the PagerDuty REST API. It allows developers to integrate PagerDuty's incident management and on-call scheduling functionalities into their applications.

What are @pagerduty/pdjs's main functionalities?

Create an Incident

This feature allows you to create a new incident in PagerDuty. The code sample demonstrates how to use the @pagerduty/pdjs package to create an incident with a specified title, service, and urgency.

const { pd } = require('@pagerduty/pdjs');

const pdClient = pd({ token: 'YOUR_API_TOKEN' });

pdClient.post('/incidents', {
  data: {
    incident: {
      type: 'incident',
      title: 'Example Incident',
      service: {
        id: 'SERVICE_ID',
        type: 'service_reference'
      },
      urgency: 'high'
    }
  }
}).then(response => {
  console.log(response.data);
}).catch(error => {
  console.error(error);
});

List Incidents

This feature allows you to list all incidents in PagerDuty. The code sample demonstrates how to use the @pagerduty/pdjs package to retrieve and log a list of incidents.

const { pd } = require('@pagerduty/pdjs');

const pdClient = pd({ token: 'YOUR_API_TOKEN' });

pdClient.get('/incidents').then(response => {
  console.log(response.data);
}).catch(error => {
  console.error(error);
});

Acknowledge an Incident

This feature allows you to acknowledge an existing incident in PagerDuty. The code sample demonstrates how to use the @pagerduty/pdjs package to change the status of an incident to 'acknowledged'.

const { pd } = require('@pagerduty/pdjs');

const pdClient = pd({ token: 'YOUR_API_TOKEN' });

pdClient.put('/incidents/INCIDENT_ID', {
  data: {
    incident: {
      type: 'incident_reference',
      status: 'acknowledged'
    }
  }
}).then(response => {
  console.log(response.data);
}).catch(error => {
  console.error(error);
});

Resolve an Incident

This feature allows you to resolve an existing incident in PagerDuty. The code sample demonstrates how to use the @pagerduty/pdjs package to change the status of an incident to 'resolved'.

const { pd } = require('@pagerduty/pdjs');

const pdClient = pd({ token: 'YOUR_API_TOKEN' });

pdClient.put('/incidents/INCIDENT_ID', {
  data: {
    incident: {
      type: 'incident_reference',
      status: 'resolved'
    }
  }
}).then(response => {
  console.log(response.data);
}).catch(error => {
  console.error(error);
});

Other packages similar to @pagerduty/pdjs

Keywords

FAQs

Package last updated on 23 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc