Andrew Smith
Andrew Smith

Reputation: 621

ServiceNow REST API endpoint for on-call employees

I am looking for an endpoint on the ServiceNow REST API to GET a list of my team's currently on-call employees, with their email addresses.

I have found a lot of info but may be missing something in the ServiceNow docs. I am trying to use the "REST API Explorer" as described on this page, but do not see the "System Web Services" section under "All" in ServiceNow.

For context, I need this endpoint for a python script in Splunk, a custom alert action that would send alert emails only to the currently on-call employees. Thus the need for this list from ServiceNow, which has the info on on-call employees.

Any and all help is much appreciated. Thanks!

Upvotes: 0

Views: 463

Answers (1)

Jessie Westlake
Jessie Westlake

Reputation: 161

I don't remember how I originally found it, but I have been using the following method:

GET /api/now/on_call_rota/whoisoncall?group_ids={{sys_id}}&date_time={{yyyy-MM-dd HH:mm:ss}}
[
  {
    "memberId": "119f399173062300e7af6238edf6a7e7",
    "memberIds": [],
    "userId": "62826bf03710200044e0bfc8bcbe5df1",
    "userIds": [],
    "roster": "9d9f399173062300e7af6238edf6a7e5",
    "rota": "349f399173062300e7af6238edf6a75e",
    "group": "096fb59173062300e7af6238edf6a783",
    "escalationGroups": [],
    "deviceId": "",
    "deviceIds": [],
    "isDevice": false,
    "order": 1,
    "isOverride": false,
    "rotationScheduleId": "119f399173062300e7af6238edf6a7df",
    "memberScheduleId": "9d9f399173062300e7af6238edf6a7ec"
  },
  {
    "memberId": "1d9f399173062300e7af6238edf6a7e8",
    "memberIds": [],
    "userId": "a8f98bb0eb32010045e1a5115206fe3a",
    "userIds": [],
    "roster": "9d9f399173062300e7af6238edf6a7e5",
    "rota": "349f399173062300e7af6238edf6a75e",
    "group": "096fb59173062300e7af6238edf6a783",
    "escalationGroups": [],
    "deviceId": "",
    "deviceIds": [],
    "isDevice": false,
    "order": 2,
    "isOverride": false,
    "rotationScheduleId": "119f399173062300e7af6238edf6a7df",
    "memberScheduleId": "d99f399173062300e7af6238edf6a7ef"
  }
]

The date_time parameter needs to be in UTC time.

This REST call loosely conforms to the Server API call found in the official documentation, so it may also support those additional parameters. I tried some of the other Server APIs at that REST endpoint, but they weren't valid.

Upvotes: 0

Related Questions