1. Reference
  2. Assertions

Reference

Assertions reference

Assertions verify that response data is correct. If any assertion fails, the check is marked as DOWN.

API monitoring assertions in OnlineOrNot

Assertion types

JSON body

Assert on values in JSON responses using JSONPath.

Field Description
Property JSONPath expression (e.g., $.data.user.name)
Expected value Value to match

Use the JSONPath online sandbox to test expressions.

Text body

Assert on text content anywhere in the response body.

Field Description
Property Text to search for
Expected value Value to match (for some comparisons)

Response headers

Assert on HTTP response headers.

Field Description
Property Header name (e.g., Content-Type)
Expected value Expected header value

HTML body

Assert on HTML elements using CSS selectors.

Field Description
Property CSS selector (e.g., meta[name="viewport"])
Expected value Expected element content

Notes:

  • Commented-out elements (<!-- ... -->) are not found
  • Supports all CSS selectors

Common CSS selector patterns:

Selector Matches
meta[name="viewport"] Exact attribute match
script[src*="analytics"] Attribute contains substring
[property^="og:"] Attribute starts with
[href$=".pdf"] Attribute ends with
.cookie-banner Class name
#main-content ID

Comparisons

Comparison Description
Equals Exact match
Not equals Does not match
Greater than Numeric comparison
Less than Numeric comparison
Null Value is null
Not null Value exists
Empty Value is empty string
Not empty Value has content
Contains Substring match
Not contains Substring not present
True Boolean true
False Boolean false