Checks

We'll assume you've already got the API authentication settled and you have our API key with you.

Great, let's move on!

Get all checks for a particular site

To know what checks are available to you, you'll need to query the sites API call first. Per site, you'll be given a set of check IDs.

In this example, we'll get the details for site ID 99. Notice the checks data attribute.

$ curl https://ohdear.app/api/sites/99 \
    -H 'Authorization: Bearer bgUKSWYL30iHg5w0WTDGHfubt5L1HBTr0atAehCeSqwNTqkU9rOmsNEmWf6Y' \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'

Here's the response:

{
  "id": 99,
  "url": "https://yoursite.tld",
  ...
  "checks": [
    {
      "id": 402,
      "type": "certificate_health",
      "enabled": true
    },
    {
      "id": 403,
      "type": "mixed_content",
      "enabled": true
    },
    ...
  ]
}

Per check, you'll see its ID. Once you know that ID, you can enable or disable that check or request a new run, on the spot.

Enable & disable a check

Let's take the first check ID, 402, as an example. First, we'll enable the check.

$ curl -X POST https://ohdear.app/api/checks/402/enable \
    -H 'Authorization: Bearer bgUKSWYL30iHg5w0WTDGHfubt5L1HBTr0atAehCeSqwNTqkU9rOmsNEmWf6Y' \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'

You make a POST call to /api/checks/{ID}/enable to enable that check. As a result, you'll be given a confirmation payload.

{
  "id": 405,
  "type": "uptime",
  "enabled": true
}

To disable, make a similar POST to the /disable endpoint.

$ curl -X POST https://ohdear.app/api/checks/402/disable \
    -H 'Authorization: Bearer bgUKSWYL30iHg5w0WTDGHfubt5L1HBTr0atAehCeSqwNTqkU9rOmsNEmWf6Y' \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'

The resulting payload will confirm the enabled attribute is set to false.

{
  "id": 405,
  "type": "uptime",
  "enabled": false
}

From that point forward, we'll no longer run that particular check.

If you want to trigger an on-demand run of a check, for instance a new mixed content scan, you can send an API call to the /request-run endpoint.

$ curl -X POST https://ohdear.app/api/checks/402/request-run \
    -H 'Authorization: Bearer bgUKSWYL30iHg5w0WTDGHfubt5L1HBTr0atAehCeSqwNTqkU9rOmsNEmWf6Y' \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'

To confirm, we'll give the details of the check once again.

Return properties

The response gives you some basic details of a check.

  • id: an internal identifier to Oh Dear!
  • type: what type of check this is. Possible values are: uptime, broken_links, certificate_health, mixed_content and certificate_transparency.
  • enabled: a boolean value to indicate if this check is enabled or not. Possible values are: true or false.

More properties will be added over time.