Environment Variables
Variables: The basics
You can make use of three key types of variable in APImetrics:
- Workflow variables - that are extracted and used in a specific sequence of linked API calls that execute one after another
- Global variables - that are set for all users in a specific project
- Environment variables - that can be set for a specific set of tests that are specified in the editor
Using variables in a call
Once you have set a variable, either by extracting a value from a response in a workflow, or in the variables setting options you can use the variable in several ways.
In a URI
For example, you have set a variable called EXAMPLE_PATH_SET and you want to make it part of your API call, you can use either "__" or "%%" to frame the variable name when you set the URI for an API call.
https://api.example.com/__EXAMPLE_PATH_SET__
https://api.example.com/%%EXAMPLE_PATH_SET%%
As a Parameter
In the API call editor you can specify the name of the variable using the same method as for a URI.
If you use a variable called TOKEN, here are the two examples for using it in the editor.
System Variables
In addition to variables you can set yourself or extract from the result of another call, we also provide a set of system variables to handle common API logic such as setting a UNIX DATE/TIME or generating a random number or location.
We even provide a means for generating a valid Credit Card number that will pass a simple checksum calculation as valid for Visa, Mastercard and Amex.
Updated over 1 year ago
Learn more about workflows and how to extract variables from calls.