Get all existing recipient groups or just those containing a specific monitor or recipient. If none was found, the operation returns an empty results
list.
Request URL
GET https://api.alertsite.com/api/v3/notifier-groups[?parameters]
Authentication
The request must include the Authorization
header containing a user’s access token:
Authorization: Bearer ACCESS_TOKEN
See Authentication for more information.
Query parameters
Query parameters are optional, but can be used to filter the results.
monidor_id
Integer. Monitor ID. If specified, only groups containing this monitor will be returned.
recipient_id
Integer. Recipient ID. If specified, only groups containing this recipient will be returned.
limit
Integer. The maximum number of results to return. Use together with offset
to paginate through a large number of results.
offset
Integer. Return the results starting from this offset (0-based).
Response body
On success, the operation returns HTTP status 200 and a JSON object containing metadata
and results
, where results
is an array of Recipient Group objects.
{
"metadata": {
"__permissions": {
"acl": 7
},
"resultset": {
"count": 1,
"limit": null,
"offset": null
}
},
"results": [
{
"errortypes": [
{
"description": "TCP connection failed",
"id": 1
},
{
"description": "Test timed out",
"id": 2
}
],
"id": 2736,
"is_default": false,
"monitors": [
{
"id": 147298,
"name": "LuciernaBank login/logout",
"step_name": null,
"step_number": 0
},
{
"id": 145192,
"name": "LuciernaBank REST API",
"step_name": null,
"step_number": 0
}
],
"name": "LuciernaBank alerts",
"recipients": [
{
"id": 12345,
"name": "DevOps mailing list",
"recipient": "[email protected]"
},
{
"id": 21453,
"name": "Slack #devops",
"recipient": "https://hooks.slack.com/services/T12345678/B5ABCDEFH/aBCd1234eFgH5678IJkl9012"
}
],
"templates": [
{
"alert_description_short": "Site Error JSON",
"id": 1021,
"name": "Slack error"
},
{
"alert_description_short": "Site Clear JSON",
"id": 1022,
"name": "Slack clear"
}
]
}
]
}
If no recipient groups were found, an empty results
array is returned:
{
"metadata": {
"__permissions": {
"acl": 7
},
"resultset": {
"count": 0,
"limit": null,
"offset": "0"
}
},
"results": []
}
Error responses have HTTP status codes in the 4xx range.
Try it out
Click here to test this operation in AlertSite’s interactive API console.
Code examples
cURL
Get all recipient groups:
curl https://api.alertsite.com/api/v3/notifier-groups -H "Authorization: Bearer ACCESS_TOKEN"
Get all recipient groups containing monitor # 123456:
curl https://api.alertsite.com/api/v3/notifier-groups?monitor_id=123456 -H "Authorization: Bearer ACCESS_TOKEN"
Python
This code prints a list of all recipient groups:
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
# 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 all recipient groups
r = requests.get(baseUrl + '/notifier-groups', headers={'Authorization': 'Bearer ' + token})
result = r.json()
if r.status_code == requests.codes.ok:
groups = result['results']
print('Total recipient groups found:', len(groups), '\n')
for group in groups:
print('ID: {id}, Name: {name}'.format(**group))
else:
print('Could not get recipient group. The following error(s) occurred:', *result['errors'], sep='\n')