Contacts 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.
Add Contact Request
Add Contact request is used to add contacts to users in OpsGenie.
Adding mobile contact is not supported.
It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
userId / username | ID or username of the user that the rule belongs to. Either of them should be specified. |
method | Method of the contact. Should be one of Email, Sms or Voice. |
to | Address of the contact. Should be a valid email address for email contacts and a valid phone number for sms and voice contacts. |
Sample Request With Username
curl -XPOST 'https://api.opsgenie.com/v1/json/user/contact' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"username": "[email protected]",
"method": "voice",
"to": "1-9999999999"
}'
Response
{
"id" : "c6de10d6-55d7-4d03-9d30-f7d8ceed7ba5",
"status" : "successful",
"code" : 200
}
Sample Request With UserId
curl -XPOST 'https://api.opsgenie.com/v1/json/user/contact' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"userId": "ac463592-dbd2-4ca3-a651d-48fhf5j5c871",
"method": "sms",
"to": "1-9999999999"
}'
Response
{
"id" : "fg463552-dvf2-4ca3-a4315-48fhf5j67875",
"status" : "successful",
"code" : 200
}
Update Contact Request
Update Contact request is used to update contacts of users in OpsGenie.
Updating mobile contact is not supported.
It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the contact that will be updated. |
userId / username | ID or username of the user that the rule belongs to. Either of them should be specified. |
to | Address of the contact. Should be a valid email address for email contacts and a valid phone number for sms and mobile contacts. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/user/contact' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"username": "[email protected]",
"id":"c6de10d6-55d7-4d03-9d30-f7d8ceed7ba5",
"to": "[email protected]"
}'
Response
{
"id" : "c6de10d6-55d7-4d03-9d30-f7d8ceed7ba5",
"status" : "successful",
"code" : 200
}
Enable Contact Request
Enable Contact request is used to enable contacts of users in OpsGenie.
It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the contact that will be enabled. |
userId / username | ID or username of the user that the rule belongs to. Either of them should be specified. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/user/contact/enable' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"username": "[email protected]",
"id":"c6de10d6-55d7-4d03-9d30-f7d8ceed7ba5"
}'
Response
{
"status" : "success"
}
Disable Contact Request
Disable Contact request is used to disable contacts of users in OpsGenie.
It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the contact that will be disabled. |
userId / username | ID or username of the user that the rule belongs to. Either of them should be specified. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/user/contact/disable' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"username": "[email protected]",
"id":"c6de10d6-55d7-4d03-9d30-f7d8ceed7ba5"
}'
Response
{
"status" : "success"
}
Delete Contact Request
Delete Contact request is used to delete contact of users in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the contact that will be deleted. |
userId / username | ID or username of the user that the rule belongs to. Either of them should be specified. |
Sample Request
curl -XDELETE 'https://api.opsgenie.com/v1/json/user/contact?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&[email protected]&id=92b1c55c-47e2-42a4-8085-1040656e39e4
Response
{
"status" : "successful",
"code" : 200
}
Get Contact 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 Contact request is used to retrieve contact details of users in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the contact that will be deleted. |
userId / username | ID or username of the user that the rule belongs to. Either of them should be specified. |
Sample Request
curl -XGET 'https://api.opsgenie.com/v1/json/user/contact?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&[email protected]&id=d670912e-25fe-4101-9719-0b72898b74e5
Response
{
"disabledReason": "",
"took": 23,
"method": "email",
"to": "[email protected]",
"id": "d670912e-25fe-4101-9719-0b72898b74e5",
"enabled": true
}
List Contacts 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 Contacts Request is used to retrieve the list of contacts of users in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
id | ID of the contact that will be deleted. |
userId / username | ID or username of the user that the rule belongs to. Either of them should be specified. |
Sample Request
curl -XGET 'https://api.opsgenie.com/v1/json/user/contact?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&[email protected]
Response
{
"userContacts": [
{
"disabledReason": "",
"method": "sms",
"to": "1-9999999999",
"id": "60b77613-f86f-4642-bf32-dee2aa678e4d",
"enabled": true
},
{
"disabledReason": "",
"method": "voice",
"to": "1-9999999999",
"id": "6987706b-eaa9-4801-9269-94b13c2eda9a",
"enabled": true
},
{
"disabledReason": "",
"method": "email",
"to": "[email protected]",
"id": "d670912e-25fe-4101-9719-0b72898b74e5",
"enabled": true
}
]
}
Updated over 7 years ago