Downtime reporting in our API

We'll assume you've already got the API authentication settled and you have our API key with you (this is the Authorization header in all the examples used below).

Retrieving downtime periods #

If a site has the uptime check enabled, you can query the downtime via the /api/downtime endpoint. To use this endpoint you'll need to now the site id of your site. You can get all sites ids by calling the get all sites endpoint.

To retrieve you'll need to specify a period via the started_at and ended_at filters.

In this example we are going to get the downtime periods for site number 1.

$ curl "https://ohdear.app/api/downtime/1?filter[started_at]=20180101150000&filter[ended_at]=20180101160000" \
    -H 'Authorization: Bearer bgUKSWYL30iHg5w0WTDGHfubt5L1HBTr0atAehCeSqwNTqkU9rOmsNEmWf6Y' \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'

Here's what the output could look like:

{
  "data":
    [
       {"started_at":"2018-01-01 15:00:00","ended_at":"2018-01-01 15:07:00"}
    ]
}
Was this page helpful to you? Feel free to reach out via support@ohdear.app or on Twitter via @OhDearApp if you have any other questions. We'd love to help!