List On-Call Users

List all users in a PagerDuty account that are on-call

by Ryan Hoskin

HTML

<script src="https://eurica.github.io/pdjs/js/pdjs.js"></script>
<div id="users"><strong>Users:</strong><br /></div>

JavaScript

//List all users in a PagerDuty account that are on-call in a specified period

PDJS = new PDJSobj({
    subdomain: "pdt-ryan",
    token: "nem6RzWzGXdR161nRXC8",
})

PDJS.api_all({
  res: "users/on_call",
  data: {
      "since": "2015-08-01",
      "until": "2015-08-02"
  },
  final_success: function(data) {
      jQuery.each(data.users, function(index, user) {
          $("#users").append(user.name + ", " + user.email + "<br/>");
      })
  },
  incremental_success: function(data) {
    console.log("Got data");
  }
})