Our new Appfire Documentation Space is now live!
Take a look here! If you have any questions please email support@appfire.com
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
{{ "/rest/api/2/issue/:issue" | callJira(verb=("PUT"), params={"issue":issue.key}, body={"fields": {"summary": "Updated Summary"} }) }}
Updates the summary of the current issue and outputs nothing
Create a new issue
{{ "/rest/api/2/issue" | callJira(verb=("post"),
body={
"fields": {
"issuetype": {
"self": "https://JMWEtest.atlassian.net/rest/api/2/issuetype/10001",
"id": "10001",
"description": "A user story. Created by JIRA Software - do not edit or delete.",
"iconUrl": "https://JMWEtest.atlassian.net/images/icons/issuetypes/story.svg",
"name": "Story",
"subtask": false
},
"project": {
"self": "https://JMWEtest.atlassian.net/rest/api/2/project/13410",
"id": "13410",
"key": "PC",
"name": "Project Cloud",
"projectTypeKey": "software",
"simplified": false,
"avatarUrls": {
"48x48": "https://JMWEtest.atlassian.net/secure/projectavatar?pid=13410&avatarId=10761",
"24x24": "https://JMWEtest.atlassian.net/secure/projectavatar?size=small&s=small&pid=13410&avatarId=10761",
"16x16": "https://JMWEtest.atlassian.net/secure/projectavatar?size=xsmall&s=xsmall&pid=13410&avatarId=10761",
"32x32": "https://JMWEtest.atlassian.net/secure/projectavatar?size=medium&s=medium&pid=13410&avatarId=10761"
}
},
"summary": "New Task"
}
}) | dump(2) }}
Creates a new current issue
{
"id": "50078",
"key": "PC-267",
"self": "https://JMWEtest.atlassian.net/rest/api/2/issue/50078"
}
Delete the current issue
{{ "/rest/api/2/issue/:issue" | callJira( verb=("DELETE"), params={"issue":issue.key} ) }}
Update Fix Version/s of the current issue
{{ "/rest/api/2/issue/:issue" | callJira(verb=("put"), params={"issue":issue.key},
body={
"fields": {
"fixVersions": [
{
"self": "https://JMWEtest.atlassian.net/rest/api/2/version/12721",
"id": "12721",
"description": "",
"name": "1.0",
"archived": false,
"released": false
}
]
}
}, impersonate=("accountId:63d6aa5a4af8460dd557a40a")) | dump(2)
}}
Updates the Fix Version/s of the current issue to 1.0 impersonating as the user with the specified accountId
.