Get a Recipient Group

Last modified on March 27, 2024

Get the recipient group configuration for the specified group ID.

Request URL

GET https://api.alertsite.com/api/v3/notifier-groups/{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 group object:

{
  "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"
    }
  ]
}

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 configuration of the recipient group with ID 2736:

cURL

curl https://api.alertsite.com/api/v3/notifier-groups/2736 -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
group_id = 2736

# 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 group configuration
r = requests.get(baseUrl + '/notifier-groups/' + str(group_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 group #{}. The following error(s) occurred:'.format(group_id), *r.json()['errors'], sep='\n')

See Also

Recipient Group Operations

Highlight search results