Forwarding Rule API

API Requests

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.

Add a Forwarding Rule

Add a forwarding rule to OpsGenie to forward notifications of one user to another. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
fromUser The username of user whose notifications will be forwarded
toUser The username of user who will receive the forwarded notifications
startDate The date and time for forwarding will start
endDate The date and time forwarding will end

Optional Parameters

Parameter Limit
alias A user defined identifier for the forwarding rule. There can be only one forwarding rule with the same alias. Provides ability to assign a known id and later use this id to perform additional actions such as update the rule, etc. 512 chars
timezone The timezone of the start and end date and time is specified. If not provided, the user's timezone is used. Please look at /docs/miscellaneous/supported-timezone-ids for available timezones.
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/user/forward' -d '
{
     "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
     "alias": "filiRule1",
     "fromUser" : "kili@opsgenie.com",
     "toUser" : "fili@opsgenie.com",
     "startDate" : "2013-01-27 22:00",
     "endDate" : "2013-01-28 08:00",
     "timezone" : "GMT+2"
}'
Response:
{
     "id" : "c6de10d6-55d7-4d03-9d30-f7d8ceed7ba5",
     "alias" : "filiRule1",
     "status" : "successful",
     "code" : 200
}
 

Update a Forwarding Rule

Updates a forwarding rule. It takes the following parameters:

Mandatory Parameters

Parameter Limit
apiKey API key is used for authenticating API requests
alias A user defined identifier for the forwarding rule. There can be only one forwarding rule with the same alias. Provides ability to assign a known id and later use this id to perform additional actions such as update the rule, etc. 512 chars
id Id of forwarding rule
fromUser The user whose notifications will be forwarded
toUser The user who will receive the forwarded notifications
startDate The date and time for forwarding will start
endDate The date and time forwarding will end
One of id or alias parameters should be specified with update forwarding rule request

Optional Parameters

Parameter
timezone The timezone of the start and end date and time is specified. If not provided, the user's timezone is used.  Please look at /docs/miscellaneous/supported-timezone-ids for available timezones.
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/user/forward' -d '
{
     "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
     "alias": "filiRule1",
     "fromUser" : "kili@opsgenie.com",
     "toUser" : "fili@opsgenie.com",
     "startDate" : "2013-01-27 22:00",
     "endDate" : "2013-01-28 08:00",
     "timezone" : "GMT+2"
}'
Response:
{
     "id" : "c6de10d6-55d7-4d03-9d30-f7d8ceed7ba5",
     "alias" : "filiRule1",
     "status" : "successful",
     "code" : 200
}

Delete a Forwarding Rule

Delete a forwarding rule. It takes the following parameters:

Mandatory Parameters 

Parameter
apiKey API key is used for authenticating API requests
alias Alias of forwarding rule
id Id of forwarding rule
One of id or alias parameters should be specified with delete forwarding rule request

Sample Request

    curl -XDELETE 'https://api.opsgenie.com/v1/json/user/forward?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&alias=filiRule1'
    
Response:
{
    "status" : "successful",
    "code" : 200
}
 

Get a Forwarding Rule

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 a forwarding rule. It takes the following parameters:

Mandatory Parameters 

Parameter
apiKey API key is used for authenticating API requests
alias Alias of forwarding rule
id Id of forwarding rule
One of id or alias parameters should be specified with get forwarding rule request

Sample Request

curl -XGET 'https://api.opsgenie.com/v1/json/user/forward?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&alias=filiRule1'
Response:
{
    "alias": "filiRule1",
    "id" :  "1234abc",
    "fromUser" : "kili@opsgenie.com",
    "toUser" : "fili@opsgenie.com",
    "startDate" : "2013-01-27 22:00",
    "endDate" : "2013-01-28 08:00",
    "timezone" : "GMT+2"
}

List Forwarding Rules

This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.

Gets the list of existing forwarding rules for all the users in the account. 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/user/forward?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889'
Response:
{
  "forwardings": [
    {
      "toUser": "kili@opsgenie.com",
      "fromUser": "fili@opsgenie.com",
      "endDate": "2016-08-26 00:00",
      "timezone": "Europe/Minsk",
      "alias": "",
      "id": "cd6f0fc3-8b5e-4f7f-9841-a53cf3dc7c46",
      "confirmed": true,
      "startDate": "2016-08-24 00:00"
    },
    {
      "toUser": "fili@opsgenie.com",
      "fromUser": "kili@opsgenie.com",
      "endDate": "2016-08-30 00:00",
      "timezone": "Europe/Minsk",
      "alias": "",
      "id": "088331e7-2a35-49ce-a1f0-471822505dfa",
      "confirmed": true,
      "startDate": "2016-08-24 00:00"
    }
  ]
}
 

List Forwarding Rules for a User

This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.

Gets the list of existing forwarding rules for a specific user. It takes the following parameters:

Mandatory Parameters

Parameter
apiKey API key is used for authenticating API requests
user The username of user that the forwarding rules will be listed for
Sample Request
curl -XGET 'https://api.opsgenie.com/v1/json/user/forward?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&user=kili@opsgenie.com'
Response:
{
    "forwardings": [
    {
      "toUser": "fili@opsgenie.com",
      "fromUser": "kili@opsgenie.com",
      "endDate": "2016-08-30 00:00",
      "timezone": "Europe/Minsk",
      "alias": "",
      "id": "088331e7-2a35-49ce-a1f0-471822505dfa",
      "confirmed": true,
      "startDate": "2016-08-24 00:00"
    }
  ]
}