In OnlineOrNot, assertions make it possible to monitor your response data for correctness, and get notified when your response data stops being correct (the word "assertion" is a fancy computer science word for "something you know to be 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
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".
Assertions support the following comparisons (in which the Property is compared to the Expected Value)
- Not equals
- Greater than
- Less than
- Not null
- Not empty
- Not contains