You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Environment variables](/platform/variables) are exposed to your API checks using the common Handlebars/Moustache templating delimiters, i.e. `{{USER_API_KEY}}`. Note that Handlebars (double brackets) variables will be URI encoded. To avoid encoding, you can access your environment variables with triple brackets, i.e. `{{{USER_API_KEY}}}`.
104
+
105
+
Variables can be used in the following API checks fields:
106
+
107
+
- URL
108
+
- Body
109
+
- Header values
110
+
- Query parameters values
111
+
- Basic authentication username and password
112
+
113
+
### Using helpers and built-in variables
114
+
115
+
Next to your own variables, we've added some built-in ones.
116
+
117
+
These variables are specific to API checks:
118
+
119
+
| Helper | Description |
120
+
|----------------------|------------ |
121
+
|`{{GROUP_BASE_URL}}`| If your check belongs to a group, this resolves to the group's configured base URL. |
122
+
|`{{REQUEST_URL}}`| The request URL. |
123
+
|`{{$UUID}}`| Generates a random UUID/v4, i.e. 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d. |
124
+
|`{{$RANDOM_NUMBER}}`| Generates a random decimal number between 0 and 10000, i.e. 345. |
125
+
|`{{moment}}`| Generates a date or time using **moment.js** and allows for formatting: <ul> <li>`{{moment "YYYY-MM-DD"}}` generates a date, i.e. 2020-08-26</li> <li>`{{moment "2 days ago" "YYYY-MM-DD"}}` generates the date two days ago: 2020-08-24</li> <li>`{{moment "last week" "X"}}` generates a UNIX timestamp from last week: 1597924480</li> </ul> |
126
+
127
+
A practical example of using the `{{moment}}` helper would be setting the pagination options on a typical API endpoint:
128
+
129
+
```
130
+
GET https://api.acme.com/events?from={{moment "last week" "X"}}&to={{moment "X"}}
131
+
```
132
+
133
+
<Info>
134
+
For a full overview of date formatting option, check the [moment.js docs](https://momentjs.com/docs/#/displaying/format/).
135
+
</Info>
136
+
137
+
In addition, you have access to these generic variables available to all checks:
138
+
139
+
<GenericRuntimeVariablesTable/>
140
+
101
141
## Import a cURL request
102
142
103
143
You can import the request method, url, headers and body from a [cURL](https://curl.haxx.se/) command.
@@ -160,44 +200,4 @@ This list shows all content types that we scrub from the response data.
160
200
|`video/x-ms-wmv`|
161
201
|`video/x-msvideo`|
162
202
|`video/x-flv`|
163
-
|`video/webm`|
164
-
165
-
## Accessing environment variables
166
-
167
-
[Environment variables](/platform/variables) are exposed to your API checks using the common Handlebars/Moustache templating delimiters, i.e. `{{USER_API_KEY}}`. Note that Handlebars (double brackets) variables will be URI encoded. To avoid encoding, you can access your environment variables with triple brackets, i.e. `{{{USER_API_KEY}}}`.
168
-
169
-
Variables can be used in the following API checks fields:
170
-
171
-
- URL
172
-
- Body
173
-
- Header values
174
-
- Query parameters values
175
-
- Basic authentication username and password
176
-
177
-
### Using helpers and built-in variables
178
-
179
-
Next to your own variables, we've added some built-in ones.
180
-
181
-
These variables are specific to API checks:
182
-
183
-
| Helper | Description |
184
-
|----------------------|------------ |
185
-
|`{{GROUP_BASE_URL}}`| If your check belongs to a group, this resolves to the group's configured base URL. |
186
-
|`{{REQUEST_URL}}`| The request URL. |
187
-
|`{{$UUID}}`| Generates a random UUID/v4, i.e. 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d. |
188
-
|`{{$RANDOM_NUMBER}}`| Generates a random decimal number between 0 and 10000, i.e. 345. |
189
-
|`{{moment}}`| Generates a date or time using **moment.js** and allows for formatting: <ul> <li>`{{moment "YYYY-MM-DD"}}` generates a date, i.e. 2020-08-26</li> <li>`{{moment "2 days ago" "YYYY-MM-DD"}}` generates the date two days ago: 2020-08-24</li> <li>`{{moment "last week" "X"}}` generates a UNIX timestamp from last week: 1597924480</li> </ul> |
190
-
191
-
A practical example of using the `{{moment}}` helper would be setting the pagination options on a typical API endpoint:
192
-
193
-
```
194
-
GET https://api.acme.com/events?from={{moment "last week" "X"}}&to={{moment "X"}}
195
-
```
196
-
197
-
<Info>
198
-
For a full overview of date formatting option, check the [moment.js docs](https://momentjs.com/docs/#/displaying/format/).
199
-
</Info>
200
-
201
-
In addition, you have access to these generic variables available to all checks:
0 commit comments