Each of the API commands described here relate to retrieving, creating, editing and deleting one or more Alert Schedules at your site. Each Alert Schedule is completely described by an Alert Schedule Hash and has a unique ALERT_SCHED_ID (alert schedule ID).
A JSON-encoded Alert Schedule Hash is shown below:
{
"id":407, # unique ALERT_SCHED_ID (generated by Uptime Cloud Monitor)
"name":"Production_Maintenance", # descriptive name
"start_time":"2014-02-12T04:03:15Z", # start time, TZ format
"end_time":"2014-02-12T05:03:15Z", # end time, TZ format
"duration":60, # Duration of maintenance window, in minutes
"state":"enabled", # state may be "enabled" or "disabled"
"match":
{ # a hash which may be empty (match all), or may include an array of tags to include
"tag":["no-latealerts"] # array of tags to match
},
"match_exclude":{}, # a hash which may be empty (exclude none), or may include an array of tags to exclude
"recurring":false # for future use; the recurring feature is not yet implemented
}
Retrieve all Alert Schedules at your site.
curl -su <APIKEY>:U https://api.copperegg.com/v2/alerts/schedules.json
curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/schedules.json
Response is an array of JSON-encoded Alert Schedule Hashes. In the following example, two Alert Schedule Hashes are returned:
[
{
"id":405,
"name":"No-notseen",
"start_time":"2014-02-12T04:03:15Z",
"end_time":"2014-02-12T05:03:15Z",
"duration":60,
"state":"enabled",
"match":{
"tag":[
"no-latealerts"
]
},
"match_exclude":{},
"recurring":false
},
{
"id":407,
"name":"Duplicate",
"start_time":"2014-02-14T17:30:00Z",
"end_time":"2014-02-14T18:15:00Z",
"duration":45,
"state":"disabled",
"match":{
"tag":[
"no-latealerts"
]
},
"match_exclude":{},
"recurring":false
}
]
Show information about a single alert schedule.
curl -su <APIKEY>:U https://api.copperegg.com/v2/alerts/schedules/<ALERT_SCHED_ID>.json
curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/schedules/<ALERT_SCHED_ID>.json
Response is a single JSON-encoded Alert Schedule Hash.
{
"id":405,
"name":"No-notseen",
"start_time":"2014-02-12T04:03:15Z",
"end_time":"2014-02-12T05:03:15Z",
"duration":60,
"state":"enabled",
"match":{
"tag":[
"no-latealerts"
]
},
"match_exclude":{},
"recurring":false
}
Create a new alert schedule.
You must include all of the following:
You may include any of the following:
curl -su <APIKEY>:U -H "Content-Type: application/json" -XPOST -d '{"name":"Duplicate","start_time":"2014-02-14T17:30:00Z","duration":60,"state":"enabled","match":{"tag":["no-latealerts"]},"match_exclude":{},"recurring":false}' https://api.copperegg.com/v2/alerts/schedules.json
curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/schedules.json -H "Content-Type: application/json" -XPOST -d '{"name":"Duplicate","start_time":"2014-02-14T17:30:00Z","duration":60,"state":"enabled","match":{"tag":["no-latealerts"]},"match_exclude":{},"recurring":false}'
Status Code 200, and a newly-created Alert Schedule Hash:
{
"id":407,
"name":"Duplicate",
"start_time":"2014-02-14T17:30:00Z",
"end_time":"2014-02-14T18:30:00Z",
"duration":60,
"state":"enabled",
"match":{
"tag":["no-latealerts"]
},
"match_exclude":{},
"recurring":false
}
Update an existing alert schedule.
ALERT_SCHED_ID (alert schedule id) as part of the path.
same as described for create.
curl -su <APIKEY>:U -H "Content-Type: application/json" -XPUT -d '{"duration":45,"state":"disabled"}' https://api.copperegg.com/v2/alerts/schedules/<ALERT_SCHED_ID.json
curl -s https://<APIKEY>:U@api.copperegg.com/v2/alerts/schedules/<ALERT_SCHED_ID>.json -H "Content-Type: application/json" -XPUT -d '{"duration":45,"state":"disabled"}'
Status Code 200, and the newly-updated Alert Schedule Hash:
{
"id":407,
"name":"Duplicate",
"start_time":"2014-02-14T17:30:00Z",
"end_time":"2014-02-14T18:15:00Z",
"duration":45,
"state":"disabled",
"match":{
"tag":["no-latealerts"]
},
"match_exclude":{},
"recurring":false
}
Delete the specified alert schedule.
ALERT_SCHED_ID (alert schedule id) as part of the path.
curl -su <APIKEY>:U -XDELETE https://api.copperegg.com/v2/alerts/schedules/<ALERT_SCHED_ID>.json
curl -s -XDELETE https://<APIKEY>:U@api.copperegg.com/v2/alerts/schedules/<ALERT_SCHED_ID>.json
Response is Status 200, empty JSON:
{}