Use this operation to get information about all monitoring locations available in your AlertSite account, including private locations.
Syntax
Request URL
GET https://www.alertsite.com/alertsite-restapi/locations
Authentication
This operation requires authentication.
Request Body
None.
Response Body
								{
  "metadata": {
    "login": "[email protected]",
    "message": "No errors.",
    "session": "ef770427109e343e",
    "status": "0"
  },
  "results": [
    {
      "backbone": "Cogent, Telia, Sprint",
      "browser_type": "CH,FF",
      "continent": "North America",
      "country": "United States",
      "has_chrome": 1,
      "has_firefox": 1,
      "has_ie": 1,
      "has_perfecto": 0,
      "has_selenium": 1,
      "has_soapui": 1,
      "id": "20",
      "name": "Atlanta, GA",
      "region": "1"
    },
    {
      "backbone": "AT&T Wireless",
      "browser_type": "FF",
      "continent": "North America",
      "country": "United States",
      "has_chrome": 0,
      "has_firefox": 1,
      "has_ie": 0,
      "has_perfecto": 0,
      "has_selenium": 0,
      "has_soapui": 1,
      "id": "26",
      "name": "Atlanta, GA - ATT Wireless",
      "region": "3"
    },
    {
      "backbone": null,
      "browser_type": "FF",
      "continent": " InSite",
      "country": " InSite",
      "has_chrome": 0,
      "has_firefox": 1,
      "has_ie": 0,
      "has_perfecto": 0,
      "has_selenium": 0,
      "has_soapui": 1,
      "id": "10273",
      "name": " InSite: Development InSite Box - 10.0.48.7",
      "region": "0"
    },
    ... and more ...
  ]
								}
							
| Note: | The id and region are returned as strings. | 
Private locations have:
- 
backbone = null
 - 
continent, country = "InSite" (for Private Node Server and InSite) or "Micro" (for PrivateNode EndPoint)
 - 
region = "0"
 
Code Examples
cURL
Using authentication by the session ID:
curl "https://www.alertsite.com/alertsite-restapi/locations?login=demo%40example.com&session=SESSION_ID"
Using authentication via the Authorization header with a bearer token:
curl -H "Authorization: Bearer BEARER_TOKEN" https://www.alertsite.com/alertsite-restapi/locations
Python
This example prints a list of your AlertSite location IDs and names.
Python
import json
import base64
baseUrl = 'https://www.alertsite.com/alertsite-restapi'
login = '[email protected]' # Replace with your AlertSite login email
password = 'pa55w0rd' # Replace with your AlertSite password
# Log in
payload = {'login': login, 'password': password}
r = requests.post(baseUrl + '/login', data=json.dumps(payload), headers={'Content-Type': 'application/json'})
session = r.json()['metadata']['session']
# Generate the bearer token to authenticate subsequent requests
# For Python 2.4-2.x:
# token = base64.b64encode(login + ':' + session)
# For Python 3.x:
token = base64.b64encode((login + ':' + session).encode('ascii')).decode('ascii')
# Get locations
r = requests.get(baseUrl + '/locations', headers={'Authorization': 'Bearer ' + token})
result = r.json()
if int(result['metadata']['status']) == 0:
for location in result['results']:
print('{id}: {name}'.format(**location))
else:
print('Error {status}: {message}'.format(**result['metadata']))
