A string representing the REST API endpoint to call. For example "https://reqres.in/api/users"
. Note it can also be another Jira instance like https://example.atlassian.net/
Note the use of named parameters instead of positional parameters because of the number of parameters and their optional nature.
Named parameter | Description | Examples | |||
---|---|---|---|---|---|
| Indicates the HTTP verb such as GET (to get information), PUT (to update existing information), POST (to post or create a new item), DELETE (to delete an item). The default is
|
updates the first name of the user whose id is
creates a new user in the rest API
| |||
| Indicates the parameters to be passed to replace placeholders in the rest-url. It is a hash of key and values. Any instance of ":key" in the The default is no param |
| |||
| Indicates the query parameters to be added to the http call. It is a hash of key and values. The values must be scalar and will be encoded appropriately. This is used to return a subset of fields. The default is no query param. |
| |||
| Indicates the body to pass to The default is no body. |
creates a new user in the API with the information provided in the body | |||
| HTTP headers to set. Example: The default is no headers |
| |||
| Indicates the options passed to the "request" call. Often this is used to pass authentication information (see the example at right) but many other options are supported (see this section for the entire list). The default is no options. Timeout duration can be set here. Value is set in milliseconds, with a default value of 20s and a maximum timeout of 3 minutes. Use the format:
Where ‘120000’ is 2 minutes. Timeout duration can be set here. Value is set in milliseconds, with a default value of 20s and a maximum timeout of 3 minutes. Use the format:
Where ‘120000’ is 2 minutes.
| The following code dumps the data for the issue with key TEST-1, operating with the provided authentication information set in
To send multiple parameters using
| |||
| Controls the response format. If The default is |
dumps the response as plain text. | |||
| If |
| |||
| If The following IP addresses are used:
The default is |
|
Here are a few examples using the callRest
filter
{{ "https://reqres.in/api/users" | callRest(query={"id":"2"}) | dump(2)}} |
Gets the information of a user with id 2
and outputs the information in a pretty JSON format with 2 spaces indentation.
Using this filter you can make calls to another Jira instance. You will need to authenticate using the username (one used to log in to the instance) and password (the API token created for the destination instance).
{{ "https://example.atlassian.net/rest/api/2/issue/TEST-1" | callRest( options = { "auth": {"username" : "abc@example.com", "password": "sdfuhsdlsle9t739875983" } }) | dump(2)}} |
dumps the details of the issue with key TEST-1 using the provided authentication information.
{{ "https://currency-exchange.p.rapidapi.com/exchange" | callRest( query={ "q": "1.0", "from": "USD", "to": "INR"}, options = ( { headers: { "x-rapidapi-host": "currency-exchange.p.rapidapi.com", "x-rapidapi-key": "89397d9ee7msh152cdc367c4c66fp16691ejsn9bb6a580e905" } } ) ) * issue.fields.customfield_11507 }} |
returns the amount in the custom field in INR currency.
In scenarios where the response from a REST API needs to be used in a template, use the {% set %}
tag. For example:
{% set response = "https://reqres.in/api/users" | callRest(query={"id":"2"}) | dump(2) %} {{ response }} {# remainder of template #} |