Schedule API (Deprecated)
Create an API Integration and obtain your apiKey to make requests listed below. Please make sure that the integration is not restricted to access configurations.
Create Schedule Request
Create schedule request is used to create schedules in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | Limit | |
---|---|---|
apiKey | API key is used for authenticating API requests | |
name | Name of schedule | 100 chars |
Optional Parameters
Parameter | |
---|---|
timezone | Timezone of schedule, look at this doc. Defaults to Root Timezone, explained in Time Constraints and Timezones document. |
enabled | Enable/disable state of schedule |
rotations | List of schedule rotations |
team | Name of the team that the schedule will be assigned to. If left empty, the schedule will be global and not belong to any team. |
description | The description of schedule. |
Mandatory Parameters Of Schedule Rotation
Parameter | |
---|---|
startDate | Date which this schedule rotation will be active. Should be given in yyyy-MM-dd HH:mm format. Minute may take 00 or 30 values. Other values will be converted to nearest one of 00 and 30 |
participants | List of groups, escalations, teams, users or the reserved word none which will be used in schedule. Each of them can be used multiple times. They will be rotated in the order they given. |
rotationType | Type of rotation. May be one of daily, weekly and hourly |
Optional Parameters Of Schedule Rotation
Parameter | |
---|---|
name | Name of rotation |
rotationLength | Length of rotation. Default is 1 |
restrictions | Used to limit schedule rotation to certain day and time of the week, using multiple start and end times for each day of the week. This allows applying different scheduling rotations at different times. |
endDate | Date which this schedule rotation will end. Should be given in yyyy-MM-dd HH:mm format. Minute may take 00 or 30 values. Other values will be converted to nearest one of 00 and 30 |
Mandatory Parameters Of Restriction
Parameter | |
---|---|
startHour | Value of the hour that frame will start. |
startMinute | Value of the minute that frame will start. Minute may take 00 or 30 values. Other values will be converted to nearest one of 00 and 30 |
endHour | Value of the hour that frame will end. |
endMinute | Value of the minute that frame will end. Minute may take 00 or 30 values. Other values will be converted to nearest one of 00 and 30 |
startDay | Name of day which time frame will start. May be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday |
endDay | Name of day which time frame will end. May be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/schedule' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"name" : "network_team_schedule",
"timezone" : "America/New_York",
"enabled" : true,
"description" : "network schedule",
"rotations" : [
{
"name":"Off Hours"
"startDate":"2013-02-10 18:00",
"endDate":"2013-07-10 12:00",
"participants":["[email protected]", "group1"],
"rotationType":"daily"
},
{
"startDate":"2013-02-10 18:00",
"participants":["group1"],
"rotationType":"hourly",
"rotationLength":8,
"restrictions":[
{"startDay":"monday", "endDay":"thursday","startHour":"8","startMinute":"30","endHour":"17","endMinute":"00"}
]
}
]
}'
Response:
{
"id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"status" : "successful",
"code" : 200
}
Update Schedule Request
Update schedule request is used to update schedules in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | Id of schedule to be updated |
name | Name of schedule to be updated |
One of id or name parameters should be specified with update schedule request
Optional Parameters
Parameter | |
---|---|
name | Name of schedule |
timezone | Timezone of schedule. Please look [Supported Locale IDs](doc:supported-locale-ids here for available timezones. |
enabled | Enable/disable state of schedule |
rotations | List of schedule rotations |
team | Name of the team that the schedule will be assigned to. |
description | The description of schedule. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/schedule' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"timezone" : "America/New_York",
"enabled" : true,
"rotations" : [
{
"startDate":"2013-02-10 18:00",
"endDate":"2013-11-10 12:00",
"participants":["[email protected]", "group1", "none"],
"rotationType":"daily"
},
{
"startDate":"2013-02-10 18:00",
"participants":["group1"],
"rotationType":"hourly",
"rotationLength":8,
"restrictions":[
{"startDay":"monday", "endDay":"thursday","startHour":"8","startMinute":"30","endHour":"12","endMinute":"00"}
]
}
]
}'
Response:
{
"status" : "successful",
"code" : 200
}
Delete Schedule Request
Delete schedule request is used to delete schedules in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | Id of schedule to be deleted |
name | Name of schedule to be deleted |
One of id or name parameters should be specified with delete schedule request
Sample Request
curl -XDELETE 'https://api.opsgenie.com/v1/json/schedule?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network_team_schedule'
curl -XDELETE 'https://api.opsgenie.com/v1/json/schedule?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
Response:
{
"status" : "successful",
"code" : 200
}
Get Schedule Request
This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.
Get schedule request is used to search and retrieve schedules in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | Id of schedule to be retrieved |
name | Name of schedule to be retrieved |
One of id or name parameters should be specified with get schedule request.
Sample Request For Schedule Retrieve
curl -XGET 'https://api.opsgenie.com/v1/json/schedule?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network_team_schedule'
curl -XGET 'https://api.opsgenie.com/v1/json/schedule?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
Response:
{
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"name": "network_team_schedule",
"timezone": "America/New_York",
"enabled": true,
"team": "operations",
"rules": [
{
"id": "3bafd5f2-10c5-4bac-8300-cd2c72e5ca39",
"startDate": "2013-02-10 18:00",
"endDate":"2013-11-10 12:00",
"participants": [
{"participant": "[email protected]","type": "user"},
{"participant": "group1","type": "group"}
],
"rotationType": "daily"
},
{
"id": "d179d522-577e-47cb-955c-226003e92ca2",
"startDate": "2013-02-10 18:00",
"participants": [
{"participant": "group1","type": "group"},
{"participant": "none"}
],
"rotationType": "hourly",
"rotationLength": 8,
"restrictions": [
{"startDay":"monday", "endDay":"thursday","startHour":"8","startMinute":"30","endHour":"17","endMinute":"00"}
]
}
]
}
Get Schedule Timeline Request
This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.
Get Schedule Timeline request is used to get the timeline of the given schedule that includes time and on-call recipient details. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | Id of schedule to be retrieved |
name | Name of schedule to be retrieved |
One of id or name parameters should be specified with get schedule request.
Optional Parameters
Parameter | |
---|---|
interval | Length of time as integer in intervalUnits to retrieve the timeline. Default value is 1 |
intervalUnit | Unit of the time to retrieve the timeline. Available values are days, weeks and months. Default value is weeks |
date | Starting date of the timeline that will be provided. Should be given in yyyy-MM-dd HH:mm format. Default date is the moment of the time that request is received. |
details | Boolean value to decide whether the details of timeline should be provided or not. If false, only the final schedule will be provided. If true; the details of the base schedule, forwardings and overrides will also be provided if exist. Default value is false |
Sample Request
curl -XGET 'https://api.opsgenie.com/v1/json/schedule/timeline?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network_team_schedule&intervalUnit=weeks'
curl -XGET 'https://api.opsgenie.com/v1/json/schedule/timeline?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871&intervalUnit=weeks'
curl -XGET 'https://api.opsgenie.com/v1/json/schedule/timeline?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871&date=2016-04-16%2018:00'
Response:
{
"schedule": {
"timezone": "Europe/Istanbul",
"name": "timeline_test",
"id": "74aba6a4-8a86-4dce-9a7b-83eaa7af7b3e",
"team": "",
"enabled": true
},
"took": 18,
"timeline": {
"startTime": 1454277600000,
"endTime": 1454882400000,
"finalSchedule": {
"rotations": [
{
"name": "",
"periods": [
{
"recipients": [
{
"displayName": "Dawson Creek",
"name": "[email protected]",
"id": "b165db52-aa87-465e-861a-7017f3359bc4",
"type": "user"
}
],
"startTime": 1454479200000,
"endTime": 1454515140000,
"type": "forwarding",
"fromUsers": [
{
"displayName": "Leonardo da Vinci",
"name": "[email protected]",
"id": "e3cb0402-0e2f-494a-8cb9-2aa785f7bbac",
"type": "user"
}
]
},
{
"recipients": [
{
"displayName": "David Copperfield",
"name": "[email protected]",
"id": "dc259f25-9358-441f-9576-fd99872f8509",
"type": "user"
}
],
"startTime": 1454515140000,
"endTime": 1454882400000,
"type": "override"
}
],
"id": "1c16ecb8-f315-4795-88d3-7308f9d18076",
"order": 0
},
{
"name": "",
"periods": [
{
"recipients": [
{
"displayName": "test_group",
"name": "test_group",
"id": "839a9dbe-8276-4c53-81be-5009c6c56a7b",
"type": "group"
}
],
"flattenedRecipients": [
{
"displayName": "David Copperfield",
"name": "[email protected]",
"id": "dc259f25-9358-441f-9576-fd99872f8509",
"type": "user"
},
{
"displayName": "Leonardo da Vinci",
"name": "[email protected]",
"id": "e3cb0402-0e2f-494a-8cb9-2aa785f7bbac",
"type": "user",
"forwardedFrom": "b165db52-aa87-465e-861a-7017f3359bc4"
}
],
"startTime": 1454479200000,
"endTime": 1454515200000,
"type": "group"
},
{
"recipients": [
{
"displayName": "test_group",
"name": "test_group",
"id": "839a9dbe-8276-4c53-81be-5009c6c56a7b",
"type": "group"
}
],
"startTime": 1454565600000,
"endTime": 1454601600000,
"type": "group"
},
{
"recipients": [
{
"displayName": "test_group",
"name": "test_group",
"id": "839a9dbe-8276-4c53-81be-5009c6c56a7b",
"type": "group"
}
],
"startTime": 1454652000000,
"endTime": 1454688000000,
"type": "group"
}
],
"id": "ae456709-8581-43ac-a9b6-0232bd260680",
"order": 0
}
]
},
"baseSchedule": {
"rotations": [
{
"name": "Rot1",
"periods": [
{
"recipients": [
{
"displayName": "Leonardo da Vinci",
"name": "[email protected]",
"id": "e3cb0402-0e2f-494a-8cb9-2aa785f7bbac",
"type": "user"
}
],
"startTime": 1454479200000,
"endTime": 1454565600000,
"type": "user"
},
{
"recipients": [
{
"displayName": "John Smith",
"name": "[email protected]",
"id": "e6e7b896-d869-42f3-8e1c-3c4c89fb9582",
"type": "user"
}
],
"startTime": 1454565600000,
"endTime": 1454652000000,
"type": "user"
},
{
"recipients": [
{
"displayName": "Leonardo da Vinci",
"name": "[email protected]",
"id": "e3cb0402-0e2f-494a-8cb9-2aa785f7bbac",
"type": "user"
}
],
"startTime": 1454652000000,
"endTime": 1454738400000,
"type": "user"
},
{
"recipients": [
{
"displayName": "John Smith",
"name": "[email protected]",
"id": "e6e7b896-d869-42f3-8e1c-3c4c89fb9582",
"type": "user"
}
],
"startTime": 1454738400000,
"endTime": 1454824800000,
"type": "user"
},
{
"recipients": [
{
"displayName": "Leonardo da Vinci",
"name": "[email protected]",
"id": "e3cb0402-0e2f-494a-8cb9-2aa785f7bbac",
"type": "user"
}
],
"startTime": 1454824800000,
"endTime": 1454882400000,
"type": "user"
}
],
"id": "1c16ecb8-f315-4795-88d3-7308f9d18076",
"order": 1
},
{
"name": "Rot2",
"periods": [
{
"recipients": [
{
"displayName": "test_group",
"name": "test_group",
"id": "839a9dbe-8276-4c53-81be-5009c6c56a7b",
"type": "group"
}
],
"startTime": 1454479200000,
"endTime": 1454515200000,
"type": "group"
},
{
"recipients": [
{
"displayName": "test_group",
"name": "test_group",
"id": "839a9dbe-8276-4c53-81be-5009c6c56a7b",
"type": "group"
}
],
"startTime": 1454565600000,
"endTime": 1454601600000,
"type": "group"
},
{
"recipients": [
{
"displayName": "test_group",
"name": "test_group",
"id": "839a9dbe-8276-4c53-81be-5009c6c56a7b",
"type": "group"
}
],
"startTime": 1454652000000,
"endTime": 1454688000000,
"type": "group"
}
],
"id": "ae456709-8581-43ac-a9b6-0232bd260680",
"order": 2
}
]
},
"overrides": {
"rotations": [
{
"name": "",
"periods": [
{
"recipients": [
{
"displayName": "David Copperfield",
"name": "[email protected]",
"id": "dc259f25-9358-441f-9576-fd99872f8509",
"type": "user"
}
],
"startTime": 1454515140000,
"endTime": 1454882400000,
"type": "override"
}
],
"id": "or",
"order": 0
}
]
},
"forwardings": {
"rotations": [
{
"name": "",
"periods": [
{
"recipients": [
{
"displayName": "Dawson Creek",
"name": "[email protected]",
"id": "b165db52-aa87-465e-861a-7017f3359bc4",
"type": "user"
}
],
"startTime": 1454479200000,
"endTime": 1454565600000,
"type": "forwarding",
"fromUsers": [
{
"displayName": "Leonardo da Vinci",
"name": "[email protected]",
"id": "e3cb0402-0e2f-494a-8cb9-2aa785f7bbac",
"type": "user"
}
]
},
{
"recipients": [
{
"displayName": "Jefferson Taylor",
"name": "[email protected]",
"id": "f53866e7-ea32-4a16-bddb-0d82ca3b291e",
"type": "user"
}
],
"startTime": 1454565600000,
"endTime": 1454652000000,
"type": "forwarding",
"fromUsers": [
{
"displayName": "John Smith",
"name": "[email protected]",
"id": "e6e7b896-d869-42f3-8e1c-3c4c89fb9582",
"type": "user"
}
]
},
{
"recipients": [
{
"displayName": "Dawson Creek",
"name": "[email protected]",
"id": "b165db52-aa87-465e-861a-7017f3359bc4",
"type": "user"
}
],
"startTime": 1454652000000,
"endTime": 1454738400000,
"type": "forwarding",
"fromUsers": [
{
"displayName": "Leonardo da Vinci",
"name": "[email protected]",
"id": "e3cb0402-0e2f-494a-8cb9-2aa785f7bbac",
"type": "user"
}
]
},
{
"recipients": [
{
"displayName": "Jefferson Taylor",
"name": "[email protected]",
"id": "f53866e7-ea32-4a16-bddb-0d82ca3b291e",
"type": "user"
}
],
"startTime": 1454738400000,
"endTime": 1454824800000,
"type": "forwarding",
"fromUsers": [
{
"displayName": "John Smith",
"name": "[email protected]",
"id": "e6e7b896-d869-42f3-8e1c-3c4c89fb9582",
"type": "user"
}
]
},
{
"recipients": [
{
"displayName": "Dawson Creek",
"name": "[email protected]",
"id": "b165db52-aa87-465e-861a-7017f3359bc4",
"type": "user"
}
],
"startTime": 1454824800000,
"endTime": 1454882400000,
"type": "forwarding",
"fromUsers": [
{
"displayName": "Leonardo da Vinci",
"name": "[email protected]",
"id": "e3cb0402-0e2f-494a-8cb9-2aa785f7bbac",
"type": "user"
}
]
}
],
"id": "1c16ecb8-f315-4795-88d3-7308f9d18076",
"order": 0
},
{
"name": "",
"periods": [],
"id": "ae456709-8581-43ac-a9b6-0232bd260680",
"order": 0
}
]
}
}
}
flattenedRecipients field is returned when the period is historical, i.e. it starts and ends before now.
List Schedules Request
This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.
List schedules request is used to list schedules in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
Sample Request
curl -XGET 'https://api.opsgenie.com/v1/json/schedule?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889'
Response:
{
"schedules": [
{
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"name": "network_team_schedule",
"timezone": "America/New_York",
"enabled": true,
"team": "operations",
"rules": [
{
"id": "d179d522-577e-47cb-955c-226003e92ca2",
"startDate": "2013-02-10 18:00",
"endDate":"2013-11-10 12:00",
"participants": [
{"participant": "[email protected]","type": "user"},
{"participant": "group1","type": "group"}
],
"rotationType": "daily",
"rotationLength": 3,
"restrictions": []
},
{
"id": "3bafd5f2-10c5-4bac-8300-cd2c72e5ca39",
"startDate": "2013-02-10 18:00",
"participants": [
{"participant": "group1","type": "group"}
],
"rotationType": "hourly",
"rotationLength": 8,
"restrictions": [
{"startDay":"monday", "endDay":"thursday","startHour":"8","startMinute":"30","endHour":"17","endMinute":"00"}
]
}
]
},
{
"id": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"name": "database_team_schedule",
"timezone": "Europe/Istanbul",
"enabled": true,
"team": "",
"rules": [
{
"id": "8cbacee1-36ac-445f-acd5-52f7ffe02987"
"startDate": "2013-02-10 18:00",
"participants": [
{"participant": "group2","type": "group"}
],
"rotationType": "daily",
"rotationLength": 3,
"restrictions": []
}
]
}
]
}
Who Is On Call Request
This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.
Who is on call request is used to retrieve current oncall participants of a specific schedule. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | Id of schedule whose current participant list will be retrieved |
name | Name of schedule whose current participant list will be retrieved |
One of id or name parameters should be specified with who is on call request.
Optional Parameters
Parameter | |
---|---|
timezone | Timezone will be used to parse the optional time parameter below. Please look here for available timezones. |
time | Time to return future date oncall participants. Should be given in yyyy-MM-dd HH:mm format. |
flat | When enabled, retrieves usernames of all on call participants. |
Sample Request For Who is OnCall Retrieve
You should escape the spaces in your url with '%20' if you are using console for curl requests.
curl -XGET 'https://api.opsgenie.com/v1.1/json/schedule/whoIsOnCall?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network_team_schedule'
curl -XGET 'https://api.opsgenie.com/v1.1/json/schedule/whoIsOnCall?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
curl -XGET 'https://api.opsgenie.com/v1.1/json/schedule/whoIsOnCall?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network_team_schedule&timezone=America/New_York&time=2013-11-12 10:00'
Response:
{
"id": "279fd0c6-c872-44fe-98a7-6843eb3abf07",
"name": "network_team_schedule",
"type": "schedule",
"participants": [
{
"name": "[email protected]",
"type": "user",
"forwarded": "false"
},
{
"name": "network_group",
"type": "group"
},
{
"name": "network_escalation",
"type": "escalation"
"participants" : [
{
"name" : "db_team_schedule",
"type" : "schedule",
"notifyType" : "next"
}
]
}
]
}
notifyType is the escalation rule's notify type for schedules. Possible values are:
- default: On-call users of the schedule.
- next: Next user in the schedule.
- previous: Previous user in the schedule.
Sample Request For Who is OnCall Retrieve When Flat Option Enabled
http://api.opsgenie.com/v1.1/json/schedule/whoIsOnCall?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=ops_team_schedule&flat=true
{
took: 66,
recipients: [
"[email protected]",
"[email protected]"
],
isEnabled: true,
name: "ops_team_schedule",
id: "edcab14a-94cf-4525-8d3b-224c30653023",
type: "schedule"
}
Who Is On Call Next Request
This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.
Who is on call next request is used to retrieve next oncall participants of a specific schedule. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | Id of schedule whose current participant list will be retrieved |
name | Name of schedule whose current participant list will be retrieved |
One of id or name parameters should be specified with who is on call next request.
Optional Parameters
Parameter | |
---|---|
flat | When enabled, retrieves usernames of all on call participants. |
Sample Request For Who is OnCall Next Retrieve
You should escape the spaces in your url with '%20' if you are using console for curl requests.
curl -XGET 'https://api.opsgenie.com/v1/json/schedule/whoIsOnCallNext?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network_team_schedule'
curl -XGET 'https://api.opsgenie.com/v1/json/schedule/whoIsOnCallNext?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'
curl -XGET 'https://api.opsgenie.com/v1/json/schedule/whoIsOnCallNext?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network_team_schedule
Response:
{
"id": "279fd0c6-c872-44fe-98a7-6843eb3abf07",
"name": "network_team_schedule",
"type": "schedule",
"finalNextOnCalls": [
{
"name": "[email protected]",
"type": "user",
"forwarded": "false"
},
{
"name": "network_escalation",
"type": "escalation"
"participants" : [
{
"name" : "db_team_schedule",
"type" : "schedule",
"notifyType" : "next"
}
]
}
],
"rotationNextOnCalls": [
{
"name": "[email protected]",
"type": "user",
"forwarded": "false"
},
{
"name": "network_group",
"type": "group"
},
{
"name": "network_escalation",
"type": "escalation"
"participants" : [
{
"name" : "db_team_schedule",
"type" : "schedule",
"notifyType" : "next"
}
]
}
]
}
rotationNextOnCalls
field contains next on-call participants in the schedule rotation with more detailed display (including forwarding of these users). On the other hand,finalNextOnCalls
contains next on-call recipients (final form) like in the final schedule view. For example, it will be different fromrotationNextOnCalls
, if there are overrides to the rotation. Other than that, the response format is the same for both fields.
notifyType is the escalation rule's notify type for schedules. Possible values are:
- default: On-call users of the schedule.
- next: Next user in the schedule.
- previous: Previous user in the schedule.
Sample Request For Who is OnCall Next Retrieve When Flat Option Enabled
http://api.opsgenie.com/v1/json/schedule/whoIsOnCallNext?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=ops_team_schedule&flat=true
Response
{
took: 66,
finalNextRecipients: [
"[email protected]",
"[email protected]"
],
rotationNextRecipients: [
"[email protected]",
"[email protected]"
],
isEnabled: true,
name: "ops_team_schedule",
id: "edcab14a-94cf-4525-8d3b-224c30653023",
type: "schedule"
}
The difference between rotationNextRecipients and finalNextRecipients fields is the same for non-flat response. rotationNexRecipients contains next on-call recipients in the schedule rotation configuration. finalNextRecipients contains next on-call recipients in the final schedule view.
List Who Is On Call Request
This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.
List Who is on call request is used to retrieve current oncall participants of all schedules. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
Optional Parameters
Parameter | |
---|---|
timezone | Timezone will be used to parse the optional time parameter below. Please look here for available timezones. |
time | Time to return future date oncall participants. Should be given in yyyy-MM-dd HH:mm format. |
flat | When enabled, retrieves usernames of all on call participants. |
Optional parameters are handled the same as in who is on-call request.
Sample Request For List Who is OnCall Retrieve of All Defined Schedules
curl -XGET 'https://api.opsgenie.com/v1.1/json/schedule/whoIsOnCall?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889'
Response:
{
"oncalls": [
{
"id": "279fd0c6-c872-44fe-98a7-6843eb3abf07",
"type": "schedule",
"name": "network_team_schedule",
"participants": [
{
"name": "[email protected]",
"type": "user",
"forwarded": "false"
}
]
},
{
"id": "279fd0c6-c872-44fe-98a7-6843eb3abf07",
"type": "schedule",
"name": "db_team_schedule",
"participants": [
{
"name": "network_group",
"type": "group"
}
]
}
]
}
Export Schedule Request
This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.
Export schedule request is used to export a schedule or personal on-call timeline of 3 months to a .ics file. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | Id of the schedule to be exported |
name | Name of the schedule or username of a specific user for export. |
One of id or name parameters should be specified with export schedule request.
Sample Request
curl -XGET 'https://api.opsgenie.com/v1/json/schedule/export?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network_team_schedule'
curl -XGET 'https://api.opsgenie.com/v1/json/schedule/export?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&[email protected]'
Response:
Returns an .ics file with the name of the schedule or user.
Updated about 7 years ago