Apps documentation
Issue Templates for Jira
Cloud Server/Data Center
Issue Templates for Jira

Cloud

Server/Data Center

Documentation
FAQ
Release notes
Articles & Videos
Last updated Jan 31, 2024

Apply template with REST API

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:

  • Connect this function with Zapier, Jenkins, or Bitbucket for example, to automatically create an issue and apply a template with data from a received e-mail.
  • Use templates from Jira Automation and apply them to an issue in any moment on any action in automation.
  • Synchronize it with Requirements and Test Management for Jira , so when a user creates an issue with a specific status a selected template can be applied and values filled.
Warning

To use Apply template with REST API enable the Apply template option in global configuration - Visibility.

Example

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.

Configuration - Generate a token

To connect Issue Templates with external software to use API, you need to generate a token.

  1. Go to Api Tokens tab in the configuration of Issue Templates (Apps>Issue Templates>Configuration>API Tokens).

  2. Click Generate token.

    Jira Issue Templates - Template Details: Relations
    Issue Templates for Jira - Template Details: Relations

  3. Type in a label, that will be used to identify tokens, and select a specific user selected from the list.

    Jira Issue Templates - Template Details: Relations
    Issue Templates for Jira - Template Details: Relations

  4. A token will be generated for this user.

    Jira Issue Templates - Template Details: Relations
    Issue Templates for Jira - Template Details: Relations

Warning

You can see and copy the token only when you create it. It can’t be accessed later on.

Configuration - REST API

Follow these steps to configure REST API (with Postman as an example).

  1. Use an API platform.

  2. Paste the API URL:

    • EU data residency - https://itc-eu.deviniti.com/public/api/apply-template
    • US and Global data residency - https://itc-us.deviniti.com/public/api/apply-template
  3. Place the token in the Authorization header as a bearer.

  4. Add application/json value to the Content-Type header.

    Jira Issue Templates - Template Details: Relations
    Issue Templates for Jira - Template Details: Relations

  5. Add the following code to the body:

{
    "issueId": "27831",
    "templateId": "TM-1"
}
Note
  • issueId is the ID of an issue that you want the template to be applied to

  • templateId is the ID 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.

  1. Click send.
    Jira Issue Templates - Template Details: Relations
    Issue Templates for Jira - Template Details: Relations

Configuration - REST API in Jira Automation

This example shows how to use REST API in Jira Automation.

Jira Issue Templates - Template Details: Relations
Issue Templates for Jira - Template Details: Relations

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:

  1. Paste the app URL ${baseURL}/public/api/apply-template.
  2. Paste the previously generated authentication token.
  3. Paste the body with the template and current issue filled (you can use smart value to get the current issue).

Result

Status Meaning
202 Accepted
400 Bad request - wrong payload (body)
401 There is no token
403 Incorrect token/invalid license