callJira
callJira
This is a custom Nunjucks filter that operates on a string representing the partial URL, starting with /rest, of the Jira REST endpoint to call and returns the response, in JSON.
For information about the Jira REST API, see:
Core API: https://developer.atlassian.com/cloud/jira/platform/rest/v2/
Jira Software-specific API: https://developer.atlassian.com/cloud/jira/software/rest/
Jira Service Desk-specific API: https://developer.atlassian.com/cloud/jira/service-desk/rest/
To make a call to any Jira Cloud REST API of another instance of Jira or any external REST API, user callRest filter
On this page:
Applies to
A string representing the partial URL, starting with /rest. For example: "/rest/api/2/issue/TEST-1"
Parameters
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 The verb is not case-sensitive. |
|
| 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 string to be appended to the url. 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. |
|
| Indicates the impersonation to be applied to the call. It is either The default is no impersonation and acts as the add-on user. |
|
dontFail | If |
|
Examples
Here are a few examples using the callJira
filter
Get the issue information
{{ "/rest/api/2/issue/:issue" | callJira(params={"issue":issue.key}) | dump(2)}}
Gets the current issue information and outputs the current issue as JSON in a pretty format with 2 spaces indentation.
Get the issue information with just the Reporter
{{ "/rest/api/2/issue/:issue" | callJira(params={"issue":issue.key}, query={"fields":"reporter"}) | dump(2) }}
Gets the current issue information and outputs the current issue with the Reporter as JSON
Update the Summary of the current issue
Updates the summary of the current issue and outputs nothing
Create a new issue
Creates a new current issue
Use dynamic data when creating an issue
To use the current issue’s data when creating a new issue, insert it into the body section. In the example below, the current issue’s project is used to create a new issue in the same project.
Delete the current issue
Update Fix Version/s of the current issue
Updates the Fix Version/s of the current issue to 1.0 impersonating as the user with the specified accountId
.