Mustache Variables
Integrations Hub for Jira allows custom variables that can be used when generating an integration request. Under the hood, we're using JSONPath and Mustache to extract and substitute variables for integration request.
It's currently possible to substitute the following:
Request URL
Request headers
Request body
Request Authorization
General usage
Variables are accessed by using the curly braces notation of Mustache.
{{variable_name}} or for an object, the dot notated getter name without the "get".
Example: {{my_object.name}} . For the value of the getName() of the my_object variable
Value variables (Primitives/Strings ie.)
{{variable}} - Substitutes the variable value
Objects
{{object_name.user.name}} - Substitutes the object_name getUser().getName() value
Collections
Iterate through lists using the following Mustache pattern:
{{#title}}{{.}}{{/title}}
See Manage Arrays for further info
Formatting dates
Date objects can be formatted by using the following syntax. {{#date}}{{#format}}java_date_format_pattern{{/format}}{{/date}}
Example:
{{#issue.updated}} {{#format}} yyyy-MM-dd {{/format}} {{/issue.updated}} - Will format issue updated date. (since v.3.8.0)
Quick Formats (since v 4.4.0)
{{now.yearMonthDay}} = YYYY-MM-DD
{{now.monthDayYear}} = MM/DD/YYYY
{{now.monthDayYear2}} = MM/DD/YY
{{now.dayMonthYear}} = DD-MM-YYYY
Default variables
Default variables that are available for every iHub integration request are:
Variable | Description |
|---|---|
{{ |
|
|
|
|
Upper case on "U" in baseUrl |
| Get all comments for the issue Usage:
|
| Get the latest comment object for an issue. Usage:
|
| Get custom field name. example;
|
| Returns the current user as a ApplicationUser object |
| {{responseHeaders.myVariable}} gives the myVariable response header. Note only available on child actions, but seen on the parents execution log. |
| Get the issue attachment(s) as a list. Can be used to post the attachment to other systems see Attachments - Multipart data or Body and How to send an attachment for more info.
Properties on a attachment:
|
.asJson | You can use the For example, if you have a data object like this: This feature is useful when you need to extract subsets or entire chains of JSON responses. This can be extra useful when filter incoming responses. Incoming Webhooks |