Team 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 Team Request

Create team request is used to create teams in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKeyAPI key is used for authenticating API requests
nameName of team. Can not exceed 100 characters.

Optional Parameters

membersThe usernames of users which will be added to team, and optionally their roles. Possible roles are 'user' and 'admin'. If not given 'user' role is set.
descriptionThe description of team.

Sample Request

curl -XPOST 'https://api.opsgenie.com/v1/json/team' -d '
{
    "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
    "name" : "operations",
    "description" : "operations team",
    "members" : [
        {"user":"[email protected]"},
        {"user":"[email protected]", "role":"admin"}
     ]
}'

Response

{
    "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
    "status" : "successful",
    "code" : 200
}

Add Team Member Request

Add team member request is used to add a team member to a team in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKeyAPI key is used for authenticating API requests
idId of the team to be updated
nameName of the team to be updated
userIdId of user to be added to the team
usernameUsername of user to be added to the team

🚧

One of id or name parameters should be specified with add team member request

🚧

One of userId or username parameters should be specified with add team member request

Optional Parameters

Parameter
roleRole of the user

Sample Request

curl -XPOST 'https://api.opsgenie.com/v1/json/team/member' -d '
{
    "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
    "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
    "userId" : "f670bd5f-1bt3-4d4d-9668-3bg0d320kef3"
}'

Response

{
    "status" : "successful",
    "code" : 200
}

Remove Team Member Request

Remove team member request is used to remove a team member from a team in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKeyAPI key is used for authenticating API requests
idId of the team to be updated
nameName of the team to be updated
userIdId of user to be removed from the team
usernameUsername of user to be removed from the team

🚧

One of id or name parameters should be specified with remove team member request

🚧

One of userId or username parameters should be specified with remove team member request

Sample Request

curl -XDELETE 'https://api.opsgenie.com/v1/json/team/member?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=replace_team_name&username=replace_username'

Response

{
    "status" : "successful",
    "code" : 200
}

Update Team Request

Update team request is used to update teams in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKeyAPI key is used for authenticating API requests
idId of team to be updated

Optional Parameters

Parameter
nameName of team
membersThe usernames of users which will be added to team, and optionally their roles. Possible roles are 'user' and 'admin'. If not given 'user' role is set.
descriptionThe description of team.

Sample Request

curl -XPOST 'https://api.opsgenie.com/v1/json/team' -d '
{
    "apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
    "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
    "name" : "operations_updated"
}'

Response

{
    "status" : "successful",
    "code" : 200
}

Delete Team Request

Delete team request is used to delete teams in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKeyAPI key is used for authenticating API requests
idId of team to be deleted.
nameName of team to be deleted.

🚧

One of id or name parameters should be specified with delete team request

Sample Request

curl -XDELETE 'https://api.opsgenie.com/v1/json/team?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network'
curl -XDELETE 'https://api.opsgenie.com/v1/json/team?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'

Response

{
    "status" : "successful",
    "code" : 200
}

Get Team 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 team request is used to search and retrieve teams in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKeyAPI key is used for authenticating API requests
idId of team to be retrieved
nameName of team to be retrieved

🚧

One of id or name parameters should be specified with get team request.

Sample Request for Team Retrieve

curl -XGET 'https://api.opsgenie.com/v1/json/team?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network'

Response

{
        "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
        "name" : "network",
        "description" : "network team",
        "members": [
            {"user":"[email protected]", "role":"user"},
            {"user":"[email protected]", "role":"admin"}
        ]
}

List Teams 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 teams request is used to list teams in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKeyAPI key is used for authenticating API requests

Sample Request For Team Retrieve

curl -XGET 'https://api.opsgenie.com/v1/json/team?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=network'
curl -XGET 'https://api.opsgenie.com/v1/json/team?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'

Response

{
    "teams":[
        {
             "id" : "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
             "name" : "network",
             "description" : "network team",
             "members" : [{"user":"[email protected]", "role":"admin"}]
        },
        {
             "id" : "fg463552-dvf2-4ca3-a4315-48fhf5j67875",
             "name" : "database",
             "description" : "database team",
             "members" : [{"user":"[email protected]", "role":"user"}]
        },
    ]
}

List Team Logs Request

List team logs request is used to retrieve team logs in OpsGenie. It takes the following parameters:

πŸ“˜

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

Mandatory Parameters

Parameter
apiKeyAPI key is used for authenticating API requests
idId of team that the logs belong to.
nameName of team that the logs belong to.

🚧

One of id or name parameters should be specified with list team logs request.

Optional Parameters

Parameter
limitPage size. Max: 100, default is 100.
orderasc/desc, default : desc
lastKeyKey which will be used in pagination.

Sample Request to retrieve team logs.

curl -XGET 'https://api.opsgenie.com/v1/json/team/log?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=operations'
curl -XGET 'https://api.opsgenie.com/v1/json/team/log?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&id=ac463592-dbd2-4ca3-a651d-48fhf5j5c871'

Response
Timestamps are Unix Epoch as milliseconds

{
    "lastKey": "13099992234_1309999223432245566",
    "logs": [
        {
            "log": "Created team.",
            "owner":"System",
            "createdAt":13099992234
        },
        {
            "log": "Updated escalation.",
            "owner":"[email protected]",
            "createdAt":13099992534
        }
    ]
}

Add Team Routing Rule Request

Add team routing rule request is used to add a routing rule to a team in OpsGenie. It takes the following parameters:

Mandatory Parameters

apiKeyAPI key is used for authenticating API requests.
teamIdId of the team that the routing rule will belong to.
teamNamename of the team that the routing rule will belong to.
notifyNotify field contains the parameter "name" which represents the name of target entity and type parameter which represents the type of the target entity. Name parameter can be set to "none" for notifying no one. In this case, type parameter is ignored. Type parameter can be set to either schedule or escalation.

🚧

One of teamId or teamName parameters should be specified with add team routing rule request

Optional Parameters

Parameter
nameName of the team routing rule.
conditionMatchTypeType of the operation will be applied on conditions. Should be one of Match All, Match Any Condition, Match All Conditions.
conditionsList of conditions will be checked before applying team routing rule. You can refer here for more about the parameter definition.
applyOrderThe order of the team routing rule within the rules. applyOrder value is actually the index of the team routing rule whose minimum value is 0 and whose maximum value is n-1 where the number of team routing rules is n. If the number of team routing rules is greater than or equal to applyOrder value, the behavior will be the same as not providing this parameter.
restrictionsTime interval that team routing rule will work. It can be just one restriction which will be applied all days, or list of restrictions will be applied to the specified days. You may refer here for more about the parameter definition.

Sample Request

curl -XPOST 'https://api.opsgenie.com/v1/json/team/routingRule' -d '
{
    "apiKey": "7aa837f3-2091-43ac-adc3-52c4f62bf132",
    "teamName": "test_team",
    "name": "nightRule",
    "conditionMatchType": "Match All Conditions",
    "conditions": [
        {
            "not": "false",
            "field": "message",
            "operation": "contains",
            "expectedValue": "night"
        },
        {
            "not": "true",
            "field": "extraProperties",
            "operation": "contains Key",
            "expectedValue": "prop1"
        }

    ],
    "applyOrder": "0",
    "notify": {
        "name": "test_team_escalation",
        "type": "escalation"
    },
    "restrictions":{
        "startHour":"15",
        "startMinute":"04",
        "endHour":"18",
        "endMinute":"58"
    }
}'

Response

{
    "status" : "successful",
    "code" : 200,
    "id":"388f2ad8-a0d5-416a-9079-8bd2fcffb2af"
}

Update Team Routing Rule Request

Update team routing rule request is used to update a routing rule of a team in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKeyAPI key is used for authenticating API requests.
idId of the team routing rule to be updated.
teamIdId of the team that the routing rule belongs to.
teamNamename of the team that the routing rule belongs to.

🚧

One of teamId or teamName parameters should be specified with update team routing rule request

Optional Parameters

Parameter
nameName of the team routing rule.
conditionMatchTypeType of the operation will be applied on conditions. Should be one of Match All, Match Any Condition, Match All Conditions.
conditionsList of conditions will be checked before applying team routing rule. You can refer here for more about the parameter definition.
notifyNotify field contains the parameter "name" which represents the name of target entity and type parameter which represents the type of the target entity. Name parameter can be set to "none" for notifying no one. In this case, type parameter is ignored. Type parameter can be set to either schedule or escalation.
restrictionsTime interval that team routing rule will work. It can be just one restriction which will be applied all days, or list of restrictions will be applied to the specified days. You may refer here for more about the parameter definition.

Sample Request

curl -XPOST 'https://api.opsgenie.com/v1/json/team/routingRule' -d '
{
    "apiKey": "7aa837f3-2091-43ac-adc3-52c4f62bf132",
    "teamName": "test_team",
    "id" : "8a68ef3b-2d03-4726-9299-f9fdc321d3f3",
    "name": "nightRule",
    "conditionMatchType": "Match All Conditions",
    "conditions": [
        {
            "not": "false",
            "field": "message",
            "operation": "contains",
            "expectedValue": "night"
        },
        {
            "not": "true",
            "field": "extraProperties",
            "operation": "contains Key",
            "expectedValue": "prop1"
        }

    ],
    "applyOrder": "0",
    "notify": {
        "name": "test_team_escalation",
        "type": "escalation"
    },
    "restrictions":{
        "startHour":"15",
        "startMinute":"04",
        "endHour":"18",
        "endMinute":"58"
    }
}'

Response

{
    "status" : "successful",
    "code" : 200
}

Change Team Routing Rule Order Request

Change team routing rule order request is used to update the order of routing rule of among routing rules of a team in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
applyOrderThe order of the team routing rule within the rules. applyOrder value is actually the index of the team routing rule whose minimum value is 0 and whose maximum value is n-1 where the number of team routing rules is n. If the number of team routing rules is greater than or equal to applyOrder value, the behavior will be the same as not providing this parameter.
apiKeyAPI key is used for authenticating API requests.
idId of the team routing rule to be updated.
teamIdId of the team that the routing rule belongs to.
teamNamename of the team that the routing rule belongs to.

🚧

One of teamId or teamName parameters should be specified with change team routing rule order request

Sample Request

curl -XPOST 'https://api.opsgenie.com/v1/json/team/routingRule/changeOrder' -d '
{
    "apiKey": "7aa837f3-2091-43ac-adc3-52c4f62bf132",
    "teamName": "test_team",
    "id" : "c762bc01-b347-44df-834e-6a791244545f",
    "applyOrder": "0"
}'

Response

{
    "status" : "successful",
    "code" : 200
}

Delete Team Routing Rule Request

Delete team routing rule request is used to delete the routing rule of a team in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKeyAPI key is used for authenticating API requests.
idId of the team routing rule to be updated.
teamIdId of the team that the routing rule belongs to.
teamNamename of the team that the routing rule belongs to.

🚧

One of teamId or teamName parameters should be specified with delete team routing rule request

Sample Request

curl -XDELETE 'https://api.opsgenie.com/v1/json/team/routingRule?apiKey=7aa837f3-2091-43ac-adc3-52c4f62bf132&teamName=test_team&id=c762bc01-b347-44df-834e-6a791244545f'

Response

{
    "status" : "successful",
    "code" : 200
}

Get Team Routing Rule 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 team routing rule request is used to get the routing rule of a team in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKeyAPI key is used for authenticating API requests.
idId of the team routing rule to be updated.
teamIdId of the team that the routing rule belongs to.
teamNamename of the team that the routing rule belongs to.

🚧

One of teamId or teamName parameters should be specified with get team routing rule request

Sample Request

curl -XGET 'https://api.opsgenie.com/v1/json/team/routingRule?apiKey=7aa837f3-2091-43ac-adc3-52c4f62bf132&teamName=test_team&id=c762bc01-b347-44df-834e-6a791244545f'

Response

{
    "id":"388f2ad8-a0d5-416a-9079-8bd2fcffb2af",
    "name":"nightRule",
    "isDefault":false,
    "conditionMatchType":"Match Any Condition",
    "conditions":[{"not":false,"field":"message","expectedValue":"night","operation":"Contains","order":0},{"not":true,"field":"extraProperties","expectedValue":"prop1","operation":"Contains Key","order":0}],
    "restrictions":{"endHour":18,"startHour":15,"startMinute":4,"endMinute":58},
    "notify":{
        "name":"Night_Schedule",
        "id":"ba3a51eb-e3ac-457e-8817-ff5b7789c1af",
        "type":"schedule"
    }
}

List Team Routing Rules 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 team routing rules request is used to get the list routing rules of a team in OpsGenie. It takes the following parameters:

Mandatory Parameters

Parameter
apiKeyAPI key is used for authenticating API requests.
teamIdId of the team that the routing rule belongs to.
teamNamename of the team that the routing rule belongs to.

🚧

One of teamId or teamName parameters should be specified with get team routing rule request

Sample Request

curl -XGET 'https://api.opsgenie.com/v1/json/team/routingRule?apiKey=7aa837f3-2091-43ac-adc3-52c4f62bf132&teamName=test_team'

Response:

{
    "rules":[
        {
            "isDefault":false,
            "name":"nightRule",
            "restrictions":{"endHour":18,"startHour":15,"startMinute":4,"endMinute":58},
            "id":"388f2ad8-a0d5-416a-9079-8bd2fcffb2af",
            "conditions":[{"not":false,"field":"message","expectedValue":"night","operation":"Contains","order":0},{"not":true,"field":"extraProperties","expectedValue":"prop1","operation":"Contains Key","order":0}],
            "conditionMatchType":"Match Any Condition",
            "notify":{
                    "name":"Night_Schedule",
                    "id":"ba3a51eb-e3ac-457e-8817-ff5b7789c1af",
                    "type":"schedule"
            }
        },
        {
            "isDefault":true,
            "name":"Default Routing Rule",
            "id":"25a59ebb-f4d1-4552-a728-7d747c8a9713",
            "conditions":[],
            "conditionMatchType":"Match All",
            "notify":{
                    "name":"none"
             }
        }
    ]
}

Parameters of Conditions

conditions field should contain list of condition objects. condition objects should have the following format:

Parameter
not
fieldAlert field will be checked for the condition. Available fields: message, alias, description, source, entity, tags, actions, extraProperties, recipients, teams.
operationCondition Operation which will be applied when comparing alert field and the expected value. Available operations changes according to the fields type.

String Operations: Contains, Equals, Starts With, Ends With, Matches, Is Empty, Equals Ignore Whitespace
List Operations: Contains, Is Empty
Map Operations: Contains, Contains Key, Contains Value, Is Empty
Number Operations: Matches, Equals, Greater Than, Less Than
* Boolean Operations: Equals
expectedValueUser defined value that will be compared with alert field according to the operation

Parameters Of Restriction

Restrictions can be only one restriction object which will be applied to all weekdays, or list of restriction objects containing additional startDay and endDay info.

To get detailed information about time restrictions, you can refer to our Time Constraints doc.

Parameter
startHourValue of the hour that team routing rule start working.
startMinuteValue of the minute that team routing rule start working.
endHourValue of the hour that team routing rule end working.
endMinuteValue of the minute that team routing rule end working.
startDayName of day when restriction will start. Mandatory only list of restriction objects. May be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday
endDayName of day when restriction will end. Mandatory only list of restriction objects. May be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday