Access

To use the alert API, you need an access token. You can create as many as you want here: access token management. Delete tokens at any time to revoke access.

All URLs for the JSON API start with:

https://www.stathat.com/x/ACCESSTOKEN

Replace ACCESSTOKEN with one of your access tokens.

Requests must come in over https.

List all alerts

Get a list of all your manual alerts.

https://www.stathat.com/x/ACCESSTOKEN/alerts

Example reply:

[{
        "id":"XXXX",
        "stat_id":"AAAA",
        "stat_name": "api call",
        "kind": "data",
        "time_window": "5m",
},
{
        "id": "YYYY",
        "stat_id":"BBBB",
        "stat_name":"overall http request time",
        "kind": "value",
        "time_window": "1h",
        "operator": "greater than",
        "threshold": 500
},
{
        "id": "ZZZZ",
        "stat_id":"CCCC",
        "stat_name":"number of paid users",
        "kind": "value",
        "time_window": "1d",
        "operator": "greater than",
        "threshold": 1000
}]

Get alert details

Get details about a single manual alert:

https://www.stathat.com/x/ACCESSTOKEN/alerts/ALERTID

Example reply:

{
        "id": "YYYY",
        "stat_id":"BBBB",
        "stat_name":"overall http request time",
        "kind": "value",
        "time_window": "1h",
        "operator": "greater than",
        "threshold": 500
}

Create an alert

Create a manual alert:

POST https://www.stathat.com/x/ACCESSTOKEN/alerts

Common parameters:

stat_id The ID of the stat for the alert
kind The type of alert to create: value, delta, or data.
time_window The time window: 5m, 1h, 3h, 1d, 1w, 1M, 1y

Data alerts require no additional parameters.

Value alert additional parameters:

threshold The threshold to compare the stat against
operator The operator used to compare the stat to the threshold: greater than, less than

Delta alert additional parameters:

percentage The percentage change that would trigger this alert
operator The operator to check for changes: different than, greater than, less than
time_delta The time period to compare the current value against: 5m, 1h, 3h, 1d, 1w, 1M, 1y

Example request:

POST https://www.stathat.com/x/ACCESSTOKEN/alerts
stat_id=BBBB&kind=value&time_window=1h&operator=greater+than&threshold=500

Example reply:

{
        "id": "YYYY",
        "stat_id":"BBBB",
        "stat_name":"overall http request time",
        "kind": "value",
        "time_window": "1h",
        "operator": "greater than",
        "threshold": 500
}

Delete an alert

Delete a manual alert:

DELETE https://www.stathat.com/x/ACCESSTOKEN/alerts/ALERTID

Example reply:

{
        "msg": "alert deleted."
}

© 2011-2015 Numerotron Inc