Working with Application Health check results 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 application health check for a site
To retrieve a list of application health checks, you'll need the website ID first.
The /api/sites/{$siteId}/application-health-checks
endpoint lists all application health checks that are running for
your site.
$ OHDEAR_TOKEN="your API token"
$ curl https://ohdear.app/api/sites/1/application-health-checks \
-H "Authorization: Bearer $OHDEAR_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json'
This is what could get as a result:
{
"data": [
{
"id": 1,
"name": "DiskUsage",
"label": "Disk usage",
"status": "failed",
"message": "The disk is nearly full (91%)",
"short_summary": "91%",
"meta": {
"usage": 91
},
"detected_at": "2021-01-01 00:00:00",
"updated_at": "2021-01-01 00:00:00"
}
]
}
Available fields
The message
property will be filled when a check failed. It will contain the message that we also have sent via a
notification.
The short_summary
property contains a string that we'll also display on the application health check overview of your
site.
The status
property can contain one of the following values:
-
ok
: the check was ok -
warning
: the check is closed to failing -
failed
: the check did fail -
crashed
: something went wrong running the check itself -
skipped
: the check wasn't performed in this run
The meta
property contains an object that contain extra info that was sent along with the check result.
Retrieving the history of a health check
The /api/sites/{$siteId}/application-health-checks/{$applicationHealthCheckId}
endpoint lists the history of results
of an application health check.
$ OHDEAR_TOKEN="your API token"
$ curl https://ohdear.app/api/sites/1/application-health-checks/1 \
-H "Authorization: Bearer $OHDEAR_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json'
It will return the history of the check results. The newest items appear first in the list.
{
"data": [
{
"id": 2,
"status": "ok",
"message": "",
"short_summary": "60%",
"meta": {
"usage": 60
},
"detected_at": "2021-01-01 00:01:00",
"updated_at": "2021-01-01 00:01:00"
},
{
"id": 1,
"status": "failed",
"message": "The disk is nearly full (91%)",
"short_summary": "91%",
"meta": {
"usage": 91
},
"detected_at": "2021-01-01 00:00:00",
"updated_at": "2021-01-01 00:00: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!