Skip to main content

Assertions

The word "assertion" is a fancy computer science word for "something you know to be correct".

In OnlineOrNot, assertions make it possible to monitor your response data for correctness, and get notified when your response data stops being correct.

How assertions work

When you create an uptime check, under "HTTP request settings", you can add multiple assertions to your check.

For JSON body responses, OnlineOrNot uses JSONPath to find the key in your JSON object. There's also an online sandbox that you can test your assertions in.

Assertions have three main fields:

  • Property, where we enter the JSONPath to the key we want to assert
  • Comparison, which is described below
  • Expected value, where we enter the value we expect to find once we find the value

API monitoring assertions in OnlineOrNot

Assertions let you check multiple things in your response:

  • That your HTTP response JSON contains an object key called "title", with the value "The Phantom Menace"
  • That your HTTP response JSON contains an object key called "errors", with a value of NULL

If any of your assertions fail, the check is considered "DOWN".