To get the configuration of a specific alert recipient, send a GET request to /recipients/{id}
where {id}
is the recipient ID.
Request URL
GET https://api.alertsite.com/api/v3/recipients/{id}
Authentication
The request must include the Authorization
header containing a user’s access token:
Authorization: Bearer ACCESS_TOKEN
See Authentication for more information.
Response body
On success, the operation returns HTTP status 200 and a JSON representation of a Recipient object:
{
"attach_screen_capture": true,
"attach_server_response": true,
"availability_alert": true,
"blackout_ids": [
"1234"
],
"id": 90626,
"method_description": "E-mail (HTML format)",
"method_id": 12,
"name": "DevOps mailing list",
"notifier_groups": [
"9916"
],
"notify_on_clear": true,
"password": null,
"performance_alert": true,
"performance_alert_type": "20",
"recipient": "[email protected]",
"repeat_performance_alerts": true,
"start_threshold": 1,
"stop_threshold": 10,
"username": null
}
Error responses have a non-200 status code and include the errors
list:
{
"errors": [
{
"code": 404,
"message": "Record not found"
}
]
}
Try it out
Click here to test this operation in AlertSite’s interactive API console.
Code examples
Get the recipient with ID 123456:
cURL
curl https://api.alertsite.com/api/v3/recipients/123456 -H "Authorization: Bearer ACCESS_TOKEN"
Python
# Python 3.5+
import requests # Requests library http://docs.python-requests.org
import json
baseUrl = 'https://api.alertsite.com/api/v3'
username = '[email protected]' # Replace with your AlertSite login email
password = 'pa55w0rd' # Replace with your AlertSite password
recipient_id = 123456
# Log in
payload = {'username': username, 'password': password}
r = requests.post(baseUrl + '/access-tokens', data=json.dumps(payload), headers={'Content-Type': 'application/json'})
token = r.json()['access_token']
# Get the recipient configuration
r = requests.get(baseUrl + '/recipients/{}'.format(recipient_id), headers={'Authorization': 'Bearer ' + token})
if r.status_code == requests.codes.ok:
print(json.dumps(r.json(), indent=2))
else:
print('Could not get recipient #{}. The following error(s) occurred:'.format(recipient_id), *r.json()['errors'], sep='\n')