Schedule Override API
If using the EU instance of Opsgenie, the URL needs to be https://api.eu.opsgenie.com for requests to be successful.
General Information
Create an API Integration and obtain your apiKey to make requests listed above. Please make sure that the integration is not restricted to access configurations.
All requests of Schedule Override API work under Schedule domain. It means that; If you are using an apiKey that belongs to a team integration, that team must be allowed to access the given schedule. Otherwise, we would respond with 403 - Forbidden (Unauthorized) with 40301 internal codeResponse
Create Schedule Override
Creates a schedule override for the specified user and schedule and it is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
HTTP Method | URL |
---|---|
POST | https://api.opsgenie.com/v2/schedules/:scheduleIdentifier/overrides |
In-Line Parameters
Referred Name | Description |
---|---|
scheduleIdentifier | Identifier of the schedule |
Query Parameters
Parameter | Mandatory | Description |
---|---|---|
scheduleIdentifierType | false | Type of the schedule identifier that is provided as an in-line parameter. Possible values are id and name. Default value is id |
JSON Body Fields
Fields | Mandatory | Description |
---|---|---|
alias | false | A user defined identifier for the override. There can be only one override with the same alias for that schedule. Provides ability to assign a known id and later use this id to perform additional actions such as update, get, etc. If this field is not set, a random alias is given. |
user | true | The user object who will take on call responsibility or reserved word none. You can refer below for example values |
startDate | true | Time for override starting, which takes a date format as (yyyy-MM-dd'T'HH:mm:ssZ) (e.g. 2017-01-15T08:00:00+02:00) |
endDate | true | Time for override ending, which takes a date format as (yyyy-MM-dd'T'HH:mm:ssZ) (e.g. 2017-01-15T08:00:00+02:00) |
rotations | false | Identifier (id or name) of rotations that override will apply. When it's set, only specified schedule rotations will be overridden. You can refer below for an example value |
One of
id
orusername
parameters should be specified in user object, iftype
field is set as user
One of
id
orname
parameters should be specified inrotations
object, if it is used
user
field example
{
"user": [
{
"type": "user",
"id": "b3578948-55b3-4acc-9bf1-2ce2db3alpa2"
},
{
"type": "user",
"username": "[email protected]"
},
{
"type": "none"
}
}
rotation
field example
{
"rotations": [
{ "id": "29c15643-7351-4337-ad6f-0fd8af8alpe2" },
{ "name": "RotationName" }
]
}
Sample Request
curl -X POST 'https://api.opsgenie.com/v2/schedules/ScheduleName/overrides?scheduleIdentifierType=name'
--header 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
--header 'Content-Type: application/json'
--data
'{
"alias" : "Override Alias",
"user" : {
"type" : "user",
"username": "[email protected]"
},
"startDate" : "2017-05-12T09:00Z",
"endDate" : "2017-05-12T15:00Z",
"rotations" : [
{
"id": "29c15643-7351-4337-ad6f-0fd8af8alpe2"
}
]
}'
Response:
{
"data": {
"alias": "Override Alias"
},
"took": 1.178,
"requestId": "a3dd8d0c-alpf-4c12-9073-d2177da3bc0c"
}
Get Schedule Override
Gets schedule override details. It takes the following parameters:
In-Line Parameters
Referred Name | Description |
---|---|
scheduleIdentifier | Identifier of the schedule |
alias | Alias of the schedule override |
Query Parameters
Parameter | Mandatory | Description |
---|---|---|
scheduleIdentifierType | false | Type of the schedule identifier that is provided as an in-line parameter. Possible values are id and name. Default value is id |
Sample Request
curl -X GET 'https://api.opsgenie.com/v2/schedules/d875e654-9b4e-4219-a803-0c2693alp8de/overrides/OverrideAlias'
--header 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'
Response
{
"data": {
"_parent": {
"id": "d875e654-9b4e-4219-a803-0c2693alp8de",
"name": "ScheduleName",
"enabled": true
},
"alias": "OverrideAlias",
"user": {
"type": "user",
"id": "alp6961a-a837-49d2-a1fe-0973013e3c3b",
"username": "[email protected]"
},
"startDate": "2017-05-15T09:00:00Z",
"endDate": "2017-05-15T15:00:00Z",
"rotations": [
{
"id": "34793506-dd3e-4e04-bba1-acb4284alp98",
"name": "Rot1"
}
]
},
"took": 0.091,
"requestId": "alp582b0-43a8-442e-8411-3b4ed9157889"
}
Update Schedule Override
Update schedule rotation request is used to update schedule rotations and it is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
In-Line Parameters
Referred Name | Description |
---|---|
scheduleIdentifier | Identifier of the schedule |
alias | Alias of the schedule override |
Query Parameters
Parameter | Mandatory | Description |
---|---|---|
scheduleIdentifierType | false | Type of the schedule identifier that is provided as an in-line parameter. Possible values are id and name. Default value is id |
JSON Body Fields
Fields | Mandatory | Description |
---|---|---|
user | true | The user object who will take on call responsibility or reserved word none. You can refer here for example values |
startDate | true | Time for override starting, which takes a date format as (yyyy-MM-dd'T'HH:mm:ssZ) (e.g. 2017-01-15T08:00:00+02:00) |
endDate | true | Time for override ending, which takes a date format as (yyyy-MM-dd'T'HH:mm:ssZ) (e.g. 2017-01-15T08:00:00+02:00) |
rotations | false | Identifier (id or name) of rotations that override will apply. When it's set, only specified schedule rotations will be overridden. |
One of
id
orusername
fields should be specified in user object, iftype
field set as user
One of
id
orname
fields should be specified inrotations
object, if it is used
Sample Request
curl -X PUT 'https://api.opsgenie.com/v2/schedules/ScheduleName/overrides/OverrideAlias?scheduleIdentifierType=name'
--header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'
--header 'Content-Type: application/json'
--data
'{
{
"user" : {
"type" : "user",
"username" : "[email protected]"
},
"startDate" : "2017-05-17T09:00Z",
"endDate" : "2017-05-18T15:00Z",
"rotations" : [
{ "name" : "Rot1" }
]
}'
Response:
{
"data": {
"alias": "OverrideAlias"
},
"took": 0.782,
"requestId": "3alp8271-17ba-48d4-8599-ee7d4ec80206"
}
Delete Schedule Override
Delete schedule override request is used to delete schedule overrides in Opsgenie and it is a write request. If the integration of the API key configured as read-only, the request will not be accepted. For more information, you can refer to API Access Management
HTTP Method | URL |
---|---|
DELETE | https://api.opsgenie.com/v2/schedules/:scheduleIdentifier/overrides/:alias |
In-Line Parameters
Referred Name | Description |
---|---|
scheduleIdentifier | Identifier of the schedule |
alias | Alias of the schedule override |
Query Parameters
Parameter | Mandatory | Description |
---|---|---|
scheduleIdentifierType | false | Type of the schedule identifier that is provided as an in-line parameter. Possible values are id and name. Default value is id |
Sample Request
curl -X DELETE 'https://api.opsgenie.com/v2/schedules/ScheduleName/overrides/OverrideAlias?scheduleIdentifierType=name'
--header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'
Response:
{
"result": "Deleted",
"took": 0.229,
"requestId": "0367a2e8-3b9f-4f00-acf0-alp1df5489f0"
}
List Schedule Overrides
List schedule override request is used to list schedule overrides in Opsgenie. It takes the following parameters:
HTTP Method | URL |
---|---|
GET | https://api.opsgenie.com/v2/schedules/:scheduleIdentifier/overrides |
In-Line Parameters
Referred Name | Description |
---|---|
scheduleIdentifier | Identifier of the schedule |
Query Parameters
Parameter | Mandatory | Description |
---|---|---|
scheduleIdentifierType | false | Type of the schedule identifier that is provided as an in-line parameter. Possible values are id and name. Default value is id |
Sample Request
curl -X GET 'https://api.opsgenie.com/v2/schedules/ScheduleName/overrides?scheduleIdentifierType=name'
--header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'
Response:
{
"data": [
{
"alias": "OverrideAlias",
"user": {
"type": "user",
"id": "4b26961a-alp7-49d2-a1fe-0973013e3c3b",
"username": "[email protected]"
},
"startDate": "2017-05-15T09:00:00Z",
"endDate": "2017-05-15T15:00:00Z",
"rotations": [
{
"id": "34793506-dd3e-4e04-bba1-acb4284bae98",
"name": "Rot1"
}
]
},
{
"alias": "OverrideAlias2",
"user": {
"type": "user",
"id": "e58d6ee3-37bd-432f-9ded-64808b761ae0",
"username": "[email protected]"
},
"startDate": "2017-05-11T10:00:00Z",
"endDate": "2017-05-11T20:00:00Z",
"rotations": []
}
],
"took": 0.19,
"requestId": "f5d09376-912a-4f73-9a43-5ca53alp808e"
}
Updated about 4 years ago