System Variables
APImetrics provides a range of pre-defined variables to automate certain aspects of API making calls.
Key Concepts
APImetrics provides a number of pre-defined system variables that can be used in an API call.
Syntax
Variables can be injected into a call by surrounding the variable name by either percentages (e.g.
%%NAME%%
) or double underscores (e.g.__NAME__
). For use in a URI, we recommend double underscore.
System Variables
Variable Name (%%VAR_NAME%% or VAR_NAME) | Description |
---|---|
DATETIME | A date string in ISO format, e.g.: 2019-07-09T19:29:43.492000 |
DATE | Returns the date only, e.g.: 2019-05-04 |
TIME | Returns the time string only, e.g.: 14:34:45 |
PROJECT_ID | The API ID of the current project - a text string, e.g. ag9zfmFwaW1ldHJpY3MtcWNyEQsSBFVzZXIYgICAtILamwoM |
PROJECT_NAME | The name of the current project, e.g. "Project Dec 20" |
CALL_ID | The API ID of the current API Call, e.g. ag9zfmFwaW1ldHJpY3MtcWNyFwsSClRlc3RTZXR1cDIYgIDgpOT1pAgM |
CALL_NAME | The name of the current API call, e.g. "Create Contact" |
CALL_RESULT_ID | The API ID of the current API Result, e.g. ag9zfmFwaW1ldHJpY3MtcWNyGAsSC1Rlc3RSZXN1bHQzGICA4IT5pKELDA |
CALL_AUTH_ID | The API ID of the Auth used by the current API Call |
CALL_TOKEN_ID | The API ID of the Token used by the current API Call |
WORKFLOW_ID | The API ID of the current Workflow, if running in a Workflow |
WORKFLOW_NAME | The Name of the current Workflow |
WORKFLOW_RESULT_ID | The API ID of the current Workflow Result, if running in a workflow |
CLIENT_ID | The client id from your selected developer key set in Authentication settings |
CLIENT_SECRET | The client secret from your selected developer key set in Authentication settings |
UNIXTIME | The current time in UNIX time (i.e the number of seconds since 1970 January 1) - e.g. 335632800 |
CREDITCARD | Generates a random 16 digit number that passes the Luhn Checksum |
VISACARD VISACARD MASTERCARD RANDCARD | Generates a random number with the correct initial digits such as it appears the relevant card-type. RANDCARD is randomly picked number from of the other three |
RANDOM | A random integer between 1 and 10000 |
RANDLAT RANDLNG | A random latitude (a 6-decimal point precision number between -90.0 an 90.0) and a random longitude (a 6-decimal point precision number between -180.0 an 180.0) |
GUID | A RFC 4122 compliant version 4 UUID (e.g. 2dbf15b4-fa53-45c7-8e37-ea8965396b42) |
TEST_ID | An ID number identifying the current test (remains constant for each test), e.g.: 5872285445521408 |
RESULT_ID | A unique ID number identifying the specific call (changes for each call made). |
TEST_RUN_ID | An ID number identifying the current workflow (remains constant throughout lifetime of workflow). |
TEST_RUN_RESULT_ID | A unique ID number identifying the specific workflow run (remains the same for all the calls in that workflow, but is different each time that workflow is triggered). |
Alert variables
There are additional variables that are set if the Workflow has been triggered as an alert. Please see the Alerts & Webhooks documentation for the full list.
Need more advanced date or time manipulation?
If you require more complex date or time formatting or manipulation, create a Workflow and use our momentjs-based REST API.
Defined Variables
Users can define variables as Global Variables or as workflow variables where variables are set from returned JSON or XML.
Updated over 1 year ago