With Issue Templates for Jira you’re not limited to using a template with Jira only. You can also use external software to trigger different events in Jira and apply a template immediately.
With this feature you can:
To use Apply template with REST API enable the Apply template option in global configuration - Visibility.
Automatic tests with Jenkins are launched, but they fail. Jenkins creates a job and then a Jira issue using REST API. It applies a template afterwards, which fills necessary information and creates a structure, used by a developer and tester to fix the error.
To connect Issue Templates with external software to use API, you need to generate a token.
Go to Api Tokens tab in the configuration of Issue Templates (Apps>Issue Templates>Configuration>API Tokens).
Type in a label, that will be used to identify tokens, and select a specific user selected from the list.
You can see and copy the token only when you create it. It can’t be accessed later on.
Follow these steps to configure REST API (with Postman as an example).
Use an API platform.
Paste the API URL:
https://itc-eu.deviniti.com/public/api/apply-template
https://itc-us.deviniti.com/public/api/apply-template
Place the token in the Authorization header as a bearer.
Add the following code to the body:
{
"issueId": "27831",
"templateId": "TM-1"
}
issueId is the ID of an issue that you want the template to be applied to
templateId is the issue key of a template you want to use.
You can use both issuekey and issueId parameters.
Go to Atlassian documentation to find out how to check an issue ID.
This example shows how to use REST API in Jira Automation.
You can use the Send web request trigger instead of issue property to apply a template with this feature.
To configure this rule you need to:
${baseURL}/public/api/apply-template
.Status | Meaning |
---|---|
202 | Accepted |
400 | Bad request - wrong payload (body) |
401 | There is no token |
403 | Incorrect token/invalid license |