Delete Blackout

Last modified on July 26, 2024

To delete a monitor blackout or a recipient blackout, send a DELETE request to /blackouts/{id}, where {id} is the blackout ID. You can delete recurring (persistent) blackouts and future one-time blackouts. Past one-time blackouts cannot be deleted.

Note: Deleting a recurring blackout deletes it from the future schedule, but information about past blackouts will remain in the historical monitoring data and in reports.

Request URL

DELETE https://api.alertsite.com/api/v3/blackouts/{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 204 without a request body.

Error responses have a non-204 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

Delete the blackout with ID 123456:

cURL

curl -X DELETE https://api.alertsite.com/api/v3/blackouts/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
blackout_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']

# Delete a blackout
r = requests.delete(baseUrl + '/blackouts/{}'.format(blackout_id), headers={'Authorization': 'Bearer ' + token})
if r.ok:
  print('Blackout {} has been deleted.'.format(blackout_id))
else:
  print('Could not delete blackout {}. The following error(s) occurred:'.format(blackout_id), *r.json()['errors'], sep='\n')

See Also

Blackout Operations

Highlight search results