API teardown script examples
Update response status
Perform additional assertions
In certain cases you might want to run additional assertion as part of your teardown script.
This can come in handy when the main assertions of the API check are not fine-grained enough, or when you want to assert against a dynamic value. An example could be wanting to assert that the timestamp returned in your response matches today’s date:
Delete created test data based on response
This is an actual script we use to monitor our own “create API check” API endpoint. It runs after a normal API check where
we POST a JSON blob to the /accounts/<uuid>/checks
endpoint, which returns the created resource with its ID.
Notice how we reuse the environment variables to pass in credentials and tokens.
Update the JSON response body
Last updated on December 11, 2024. You can contribute to this documentation by editing this page on Github