API Check has 4 different types of variables:
- Built-In variables are initialized at the beginning of the check before any steps have run. These variables remain constant within a run but will change between runs.
- Request variables are updated after every request step.
- Custom variables are created by the user.
- Global Variables that can be shared across checks.
Built-in variables
There are many built-in variables in API Check that can be accessed within steps. Built-In variables are initialized at the beginning of the check before any steps have run. These variables remain constant within a run but will change between runs.
Random variables
- random.hex - fc7eaf12b54eb220ac1758c657518dee
- random.integer - 1463500376
Date variables
- date.today - 2016-05-17
- date.year - 2016
- date.month - 05
- date.day - 17
Time variables
- time.now - 2016-10-18 13:46:02 -0400
Location variables
- location.region - us-east-1
- location.public_ip - 54.208.109.193
- location.name - N. Virginia
- location.name_as_param - N.-Virginia
- location.latitude - 39.0437
- location.longitude - -77.4875
- location.geolocation - {"coords":{"latitude":"39.0437","longitude":"-77.4875"}}
Check-specific variables
- check.run_counter (increments by 1 every time the check is queued) - 34
- check.location_run_counter (increments by 1 every time the check is queued to a location) - 21
Request variables
- response.body
- response.body_size
- response.code
- response.response_time (in milliseconds)
- response.dns_time (in milliseconds)
- response.first_byte_time (in milliseconds)
Additionally response headers can be accessed via the headers namespace. For example, to access the Cache-Control header, use the headers.Cache-Control variable name surrounded by double braces.
Custom Variables
Custom variables are stored in the custom namespace. If you create a variable named url, it will be stored as custom.url and can be accessed in a step as {{custom.url}}.
Global Variables
Global Variables are variables that can be used across checks. They are stored in the env namespace. If you create a variable with a key of api-key, you can access it in a step as {{env.api-key}}. See Create a Global Variable to learn more.
Concealed Global Variables
Concealed Global Variables are a special type of Global Variable for which the value is permanently concealed from all users of the account. This lets you create and save variables such as test login credentials, API keys, and other sensitive information. See Create a Concealed Global Variable to learn more.