New: Terraform Provider & Linux Private Checkpoints. See more.

  1. Support
  2. Knowledge base
  3. Synthetic Monitoring
  4. API Monitoring
  5. Multi-step monitoring
  6. Set up multi-step API response
  7. Multi-step API comparison operators

Multi-step API comparison operators

If you’re new to assertions, we recommend reading the Assertions article for an overview of how they work and function. This article explains how to use the assertion comparison field to validate the API response.

When creating an assertion in a step, you’ll need to define what kind of check will be used to evaluate the value from the response.

Assertions

Listed below are the comparison operators available for use.

Is equal to

This operation checks whether the value from the response ( assertion source and property fields) is equal and the same to the specified target value. If you are comparing text or content values, this operator allows you to perform a case-insensitive comparison.

Examples

  • Status code Is equal to 200
  • Response body as JSON [0].DestinationName Is equal to Alpha Cygnus IX

Is not equal to

This operation checks whether the value from the response ( assertion source and property fields) is NOT equal and not the same as the specified target value. If you are comparing text or content values, this operator allows you to perform a case-insensitive comparison.

Examples

  • Status code Is not equal to 200
  • Response body as JSON [0].DestinationName Is not equal to Alpha Cygnus IX

Contains

This operation checks whether the value from the response ( assertion source and property fields) includes the specified target value.

Both the source and target values are interpreted as text even if they are numbers. This operation checks if the target value exists in the source value text.

Examples

  • Status description contains Not Found
  • Response body as JSON [0].DestinationName contains Alpha

Does not contain

This operation checks whether the value from the response ( assertion source and property fields) doesn’t find the specified target value from the content.

Examples

  • Status description does not contain Not Found
  • Response body as JSON [0].DestinationName does not contain Alpha

Is less than

This operation checks whether the value from the response ( assertion source and property fields) is less than the specified target value. Ensure both values are numbers and that source < target is true.

Examples

  • Duration (ms) is less than 25000
  • Response body as JSON [0].Price is less than 15

Is less than or equal to

This operation checks whether the value from the response ( assertion source and property fields) is less than or equal to the specified target value. Ensure both values are numbers and that source <= target is true.

Examples

  • Duration (ms) is less than or equal to 15000
  • Response body as JSON [0].ProductStocks is less than or equal to 10

Is greater than

This operation checks whether the value from the response ( assertion source and property fields) is greater than the specified target value. Ensure both values are numbers and that source > target is true.

Examples

  • Content length (bytes) is greater than 60
  • Response body as JSON [0].ProductStocks is greater than 50

Is greater than or equal to

This operation checks whether the value from the response ( assertion source and property fields) is greater than or equal to the specified target value. Ensure both values are numbers and that source >= target is true.

Examples

  • Content length (bytes) is greater than or equal to 60
  • Response body as JSON [0].ProductStocks is greater than or equal to 50

Is empty

This operation checks whether the value from the response ( assertion source and property fields) contains an empty string. This means that the field or value from the response exists, but has no content.

Examples

  • Empty string: ""
  • Empty array: []
  • Empty data set: {}

Is not empty

This operation checks whether the value from the response ( assertion source and property fields) exists and contains any content, such as text or number. Target values must not be "", [], {}, null.

Is null

This operation checks whether the value from the response ( assertion source and property fields) contains a null, missing, or unknown value. For example, null.

Is not null

This operation checks whether the value from the response ( assertion source and property fields) contains any content, such as text, number, or empty values ("", [], {}), except for null.

Exists

This operation checks whether the value from the response ( assertion source and property fields) exists. It ignores whether the value contains any number, text, null, or just empty content.

Examples

  • Response body as JSON [0].DestinationName exists
  • Cookie CookieName exists

Does not exist

This operation checks whether the value from the response ( assertion source and property fields) is not present and not included as part of the output.

Examples

  • Response body as JSON [0].DestinationName does not exist
  • Cookie CookieName does not exist

Should be ignored

This operation indicates that the value from the response ( assertion source and property fields) shouldn’t be automatically checked. This option can be used to cancel out the default assertions set on the Status code and Response completed fields. For more information, refer to Assertion source and property fields.

Examples

  • Response body as JSON [0].Counter should be ignored
  • Response body as text [?&]utm_[^=&]+=[^&]* should be ignored
By using the Uptrends website, you consent to the use of cookies in accordance with our Cookie Policy.