Types de moniteurs
API (JSON) monitors
Monitor REST and health endpoints with custom methods, headers and bodies, then assert a value in the JSON response with a simple path.
- API type
api- You enter
- URL
- Runs at most every
- Plan minimum
- Needs
- None
FastPing sends the request with your method, headers and body, applies the same status-code, redirect and timeout rules as a website monitor, and then, if you set a JSON path, parses the response as JSON and compares the value at that path with the expected value.
- The body is sent for POST, PUT and PATCH requests only. When you send a body without a
Content-Typeheader,application/jsonis used. - Headers are written one per line as
Name: value. - Only the first 512 KB of the response are read, so very large responses cannot be parsed.
| Field | API option | Default | Notes |
|---|---|---|---|
| URL | url | Required | http:// or https:// address; https:// is added when you leave out the scheme |
| Method | method | GET | One of: GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS |
| Expected status codes | expectedStatus | None | Up to 60 characters |
| Timeout (seconds) | timeout | 15 | 2 to 60 |
| Warn if slower than (ms) | maxMs | None | 0 to 60,000 |
| Follow redirects | followRedirects | On | |
| Request headers | headers | None | Up to 4,000 characters. One per line, "Name: value". |
| Request body | body | None | Up to 10,000 characters |
| JSON path to check | jsonPath | None | Up to 200 characters |
| Expected value | jsonExpected | None | Up to 200 characters |
| Check interval | interval | Your plan's minimum | From your plan's minimum up to 24 hours |
The path is a list of keys separated by dots. Array elements are addressed by their position, starting at 0. There are no wildcards or filters, and the path does not start with $.
For this response:
{
"status": "ok",
"checks": { "database": "ok", "queue": { "lag": 3 } },
"regions": [ { "name": "eu", "healthy": true } ]
}| Path | Value |
|---|---|
status | ok |
checks.database | ok |
checks.queue.lag | 3 |
regions.0.healthy | true |
The comparison is on the text form of the value, so the expected value true matches the boolean true and 3 matches the number 3. It is case-sensitive. Leave the expected value empty to check only that the response is valid JSON. A path that does not exist gives the value undefined and fails when an expected value is set.
Health endpoint with a dependency check
URL https://api.example.com/health, JSON path checks.database, expected value ok.
Authenticated endpoint
Request headers:
Authorization: Bearer <read-only token>
Accept: application/jsonHeader values are stored with the monitor's configuration, are visible to your team and are included in data exports. Use a dedicated token with the least access possible.
GraphQL
Method POST, URL https://api.example.com/graphql, request body {"query":"{ __typename }"}, JSON path data.__typename, expected value Query.
| Message | What it means | What to do |
|---|---|---|
Response is not valid JSON | A JSON path is set but the body could not be parsed: an HTML error page, an empty body or a response larger than 512 KB. | Open the URL with the same headers (for example with curl) and check what comes back. |
checks.database = "degraded" (expected ok) | The value at the path differs from the expected value. | The service reports a problem; fix it, or adjust the expected value if the response format changed. |
status = undefined (expected ok) | The path does not exist in the response. | Check the spelling and the nesting of the keys, and remember that arrays use positions (items.0.id). |
HTTP 401 | The endpoint rejected the credentials. | Check the Authorization header and whether the token expired. |
HTTP 405 | The method is not allowed on this URL. | Use the method the endpoint expects. |
Connection and certificate errors are listed in Website (HTTP) monitors.