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 Apr 16, 2023

REST API

Discover REST API methods for Issue Templates

REST API methods allow you to perform several actions within the Issue Templates app using Postman or any other similar tool. All possible actions are listed in the right-hand side navigation menu.

Info

For more information on using REST API in Jira, see official Atlassian documentation.

Parameter definitions

Parameter Definition
id Identifier of a single default template’s configuration. It appears only as a response.
projectIdOrKey Identifier or key of a project. You’ll find it under Project settings > Details > Key. Example: the project ID of the Template Repository is TEMP.
projectId You’ll find it at the end of the URL that appears when you hover the cursor over Details within Project settings. Example: https://jira.company.com/.../pid=10100
templateId Template ID represents the record of the template’s data related to the issue. You’ll find it under Issue Template’s right-hand side panel on issue view. Example: Template ID: 1526
issueTypeId ID of the Jira issue type. You’ll find it under Project configuration > Issue Types, at the end of the URL that appears when you hover the cursor over an issue type. It’s also visible in the Jira global issue type’s configuration, on hover over Edit. Example: https://jira.company.com/.../issuetypes/10400
issueTypeIds A set of issue type’s IDs. You can check it the same way as you would do with issueTypeId.
requestTypeId ID of the Jira request type. You’ll find it under Project configuration > Request Types, at the end of the URL that appears when you hover the cursor over Edit fields. Example: https://jira.company.com/.../request-type/43
requestTypeIds A set of issue type’s IDs. You can check it the same way as you would do with requestTypeId.
serviceDesk A flag (true or false value) showing if the configuration is applicable to Service Management.
transitions Appears as a response, but only if it has already been defined. The field is not supported when you create or modify a new configuration using REST API.
created Number of single entries created in the default template configuration.
removed Number of single entries removed in the default template configuration.
defaults A set of single entries in the default template configuration. Depending on the context, it might be used either for creating, configuring or removing default templates.

Create issue from a template

To apply a template when creating an issue via REST API, the app requires the Deviniti Issue Templates - Create structure post function which should be added to the create transition in the target project. Thanks to that, all field values included in the template will be autocompleted in the newly created issue.

To overwrite some values, such as for example summary or description, and use the values from the template, enable the Overwrite option in the Set of fields settings:

Jira Issue Templates
Issue Templates for Jira

Request

curl -D- -u admin:admin -X POST --data <json data from below> -H "Content-Type: application/json" http://localhost:8080/rest/api/2/issue
Info

To learn more about CURL requests, see the GitHub documentation.

Request data

This is an exemplary JSON that can be used as data in the request (above).

     {"fields": {
        "project":
        {
           "key": "EXMP"
        },
        "summary": "Jira create issue API",
        "issuetype": {
           "name": "Bug"
        },
        "customfield_10000" : "7"
      }
  
Note

This example is based on the Jira REST API method for creating a new issue with the indicated value of the Template custom field. Value of the customfield_id is the ID of the template.

Configure default templates

The following REST API allows you to set a template as default. It is possible to define a default template in many projects at once (including Jira Service Management), together with the issue types’ configuration.

Path structure

The following table shows the basic structure of Default Templates URL and URI paths.

Path type Path structure Description
URL /rest/api/it/1.0/default-template/ Base URL for all Default Template REST API methods
URI http://host:port/context/rest/api/it/1.0/default-template Root of the Default Template API

Get By Project

Request

GET /rest/api/it/1.0/default-template/project/{projectIdOrKey}

Response

[
    {
        "id": 130,
        "templateId": 1472,
        "issueTypeId": "10400",
        "projectId": 11100,
        "serviceDesk": false,
        "transitions": []
    },
    {
        "id": 131,
        "templateId": 1472,
        "projectId": 11100,
        "requestTypeId": 39,
        "serviceDesk": true,
        "transitions": []
    },
    {
        "id": 132,
        "templateId": 1473,
        "issueTypeId": "10401",
        "projectId": 11100,
        "serviceDesk": false,
        "transitions": []
    },
    {
        "id": 133,
        "templateId": 1473,
        "issueTypeId": "10403",
        "projectId": 11100,
        "serviceDesk": false,
        "transitions": []
    },
    {
        "id": 134,
        "templateId": 1473,
        "projectId": 11100,
        "requestTypeId": 40,
        "serviceDesk": true,
        "transitions": []
    },
    {
        "id": 135,
        "templateId": 1473,
        "projectId": 11100,
        "requestTypeId": 42,
        "serviceDesk": true,
        "transitions": []
    }
]

Get by Project and Template

Request

GET /rest/api/it/1.0/default-template/project/{projectIdOrKey}/template/{templateId}

Response:

[
    {
        "id": 167,
        "templateId": 1474,
        "issueTypeId": "10402",
        "projectId": 11100,
        "serviceDesk": false,
        "transitions": []
    },
    {
        "id": 168,
        "templateId": 1474,
        "issueTypeId": "10404",
        "projectId": 11100,
        "serviceDesk": false,
        "transitions": []
    },
    {
        "id": 169,
        "templateId": 1474,
        "projectId": 11100,
        "requestTypeId": 41,
        "serviceDesk": true,
        "transitions": []
    },
    {
        "id": 170,
        "templateId": 1474,
        "projectId": 11100,
        "requestTypeId": 43,
        "serviceDesk": true,
        "transitions": []
    }
]

Get By Template

Request

GET /rest/api/it/1.0/default-template/template/{templateId}

Response

[
    {
        "id": 165,
        "templateId": 1474,
        "issueTypeId": "10402",
        "projectId": 11000,
        "serviceDesk": false,
        "transitions": []
    },
    {
        "id": 166,
        "templateId": 1474,
        "issueTypeId": "10404",
        "projectId": 11000,
        "serviceDesk": false,
        "transitions": []
    },
    {
        "id": 167,
        "templateId": 1474,
        "issueTypeId": "10402",
        "projectId": 11100,
        "serviceDesk": false,
        "transitions": []
    },
    {
        "id": 168,
        "templateId": 1474,
        "issueTypeId": "10404",
        "projectId": 11100,
        "serviceDesk": false,
        "transitions": []
    },
    {
        "id": 169,
        "templateId": 1474,
        "projectId": 11100,
        "requestTypeId": 41,
        "serviceDesk": true,
        "transitions": []
    },
    {
        "id": 170,
        "templateId": 1474,
        "projectId": 11100,
        "requestTypeId": 43,
        "serviceDesk": true,
        "transitions": []
    }
]

Get by Template with Request Body included

Request

GET /rest/api/it/1.0/default-template/template/{templateId}

Request using projectId:

{
	"defaults": [
		{
			"projectId": 11100,
			"requestTypeIds": [
				41
			]
		}
	]
}

(Example 1) Request using projectKey:

{
	"defaults": [
		{
			"projectKey": "DTSDP",
			"requestTypeIds": [
				41
			]
		}
	]
}

(Example 1) Response:

[
    {
        "id": 169,
        "templateId": 1474,
        "projectId": 11100,
        "requestTypeId": 41,
        "serviceDesk": true,
        "transitions": []
    }
]

(Example 2) Request using projectId:

{
	"defaults": [
		{
			"projectId": 11100,
			"requestTypeIds": [
				41
			],
			"issueTypeIds": [
				10402, 10404
			]
		}
	]
}

(Example 2) Request using projectKey:

{
	"defaults": [
		{
			"projectKey": "DTSDP",
			"requestTypeIds": [
				41
			],
			"issueTypeIds": [
				10402, 10404
			]
		}
	]
}

(Example 2) Response:

[
    {
        "id": 167,
        "templateId": 1474,
        "issueTypeId": "10402",
        "projectId": 11100,
        "serviceDesk": false,
        "transitions": []
    },
    {
        "id": 168,
        "templateId": 1474,
        "issueTypeId": "10404",
        "projectId": 11100,
        "serviceDesk": false,
        "transitions": []
    },
    {
        "id": 169,
        "templateId": 1474,
        "projectId": 11100,
        "requestTypeId": 41,
        "serviceDesk": true,
        "transitions": []
    }
]

Create for Template

Request

POST /rest/api/it/1.0/default-template/template/{templateId}

Request using projectId:

{
	"defaults": [
		{
			"projectId": 11000,
			"issueTypeIds":[
				10402, 10404
			]
		},
		{
			"projectId": 11100,
			"issueTypeIds":[
				10402, 10404
			]
		},
		{
			"projectId": 11100,
			"requestTypeIds":[
				41,
				43
			]
		}
	]
}

Request using projectKey:

{
	"defaults": [
		{
			"projectKey": "DTSP",
			"issueTypeIds":[
				10402, 10404
			]
		},
		{
			"projectKey": "DTSDP",
			"issueTypeIds":[
				10402, 10404
			]
		},
		{
			"projectKey": "DTSDP",
			"requestTypeIds":[
				41,
				43
			]
		}
	]
}

Response:

{
	"defaults": [
		{
			"projectKey": "DTSP",
			"issueTypeIds":[
				10402, 10404
			]
		},
		{
			"projectKey": "DTSDP",
			"issueTypeIds":[
				10402, 10404
			]
		},
		{
			"projectKey": "DTSDP",
			"requestTypeIds":[
				41,
				43
			]
		}
	]
}

Delete by Template with Request Body included

Request:

{
	"defaults": [
		{
			"projectKey": "DTSDP",
			"requestTypeIds": [
				43
			],
			"issueTypeIds": [
				10404
			]
		}
	]
}

Response:

{
    "removed": 2,
    "defaults": [
        {
            "id": 172,
            "templateId": 1474,
            "issueTypeId": "10404",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        },
        {
            "id": 174,
            "templateId": 1474,
            "projectId": 11100,
            "requestTypeId": 43,
            "serviceDesk": true,
            "transitions": []
        }
    ]
}

Delete by Template

Request

DELETE /rest/api/it/1.0/default-template/template/{templateId}

Response:

{
    "removed": 6,
    "defaults": [
        {
            "id": 160,
            "templateId": 1474,
            "issueTypeId": "10402",
            "projectId": 11000,
            "serviceDesk": false,
            "transitions": []
        },
        {
            "id": 162,
            "templateId": 1474,
            "issueTypeId": "10404",
            "projectId": 11000,
            "serviceDesk": false,
            "transitions": []
        },
        {
            "id": 163,
            "templateId": 1474,
            "issueTypeId": "10404",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        },
        {
            "id": 164,
            "templateId": 1474,
            "projectId": 11100,
            "requestTypeId": 43,
            "serviceDesk": true,
            "transitions": []
        },
        {
            "id": 144,
            "templateId": 1474,
            "issueTypeId": "10402",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        },
        {
            "id": 146,
            "templateId": 1474,
            "projectId": 11100,
            "requestTypeId": 41,
            "serviceDesk": true,
            "transitions": []
        }
    ]
}

Delete by Project

Request

DELETE /rest/api/it/1.0/default-template/project/{projectIdOrKey}

Response:

{
    "removed": 3,
    "defaults": [
        {
            "id": 130,
            "templateId": 1472,
            "issueTypeId": "10400",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        },
        {
            "id": 131,
            "templateId": 1472,
            "projectId": 11100,
            "requestTypeId": 39,
            "serviceDesk": true,
            "transitions": []
        },
        {
            "id": 132,
            "templateId": 1473,
            "issueTypeId": "10401",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        }
    ]
}

Delete by Project and Template

Request

DELETE /rest/api/it/1.0/default-template/project/{projectIdOrKey}/template/{templateId}

Response:

{
    "removed": 3,
    "defaults": [
        {
            "id": 130,
            "templateId": 1472,
            "issueTypeId": "10400",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        },
        {
            "id": 131,
            "templateId": 1472,
            "projectId": 11100,
            "requestTypeId": 39,
            "serviceDesk": true,
            "transitions": []
        },
        {
            "id": 132,
            "templateId": 1473,
            "issueTypeId": "10401",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        }
    ]
}

Delete by Project, Template and Issue Type

Request

DELETE /rest/api/it/1.0/default-template/project/{projectIdOrKey}/template/{templateId}/issuetype/{issueTypeId}

Response:


{
    "removed": 3,
    "defaults": [
        {
            "id": 130,
            "templateId": 1472,
            "issueTypeId": "10400",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        },
        {
            "id": 131,
            "templateId": 1472,
            "projectId": 11100,
            "requestTypeId": 39,
            "serviceDesk": true,
            "transitions": []
        },
        {
            "id": 132,
            "templateId": 1473,
            "issueTypeId": "10401",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        }
    ]
}

Delete by Project, Template and Request Type

Request

DELETE /rest/api/it/1.0/default-template/project/{projectIdOrKey}/template/{templateId}/requesttype/{requestTypeId}

Response:

{
    "removed": 3,
    "defaults": [
        {
            "id": 130,
            "templateId": 1472,
            "issueTypeId": "10400",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        },
        {
            "id": 131,
            "templateId": 1472,
            "projectId": 11100,
            "requestTypeId": 39,
            "serviceDesk": true,
            "transitions": []
        },
        {
            "id": 132,
            "templateId": 1473,
            "issueTypeId": "10401",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        }
    ]
}

Delete by Template and Issue Type

Request

DELETE /rest/api/it/1.0/default-template/template/{templateId}/issuetype/{issueTypeId}

Response:

{
    "removed": 3,
    "defaults": [
        {
            "id": 130,
            "templateId": 1472,
            "issueTypeId": "10400",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        },
        {
            "id": 131,
            "templateId": 1472,
            "projectId": 11100,
            "requestTypeId": 39,
            "serviceDesk": true,
            "transitions": []
        },
        {
            "id": 132,
            "templateId": 1473,
            "issueTypeId": "10401",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        }
    ]
}

Delete by Template and Request Type

Request

DELETE /rest/api/it/1.0/default-template/template/{templateId}/requesttype/{requestTypeId}

Response:

{
    "removed": 3,
    "defaults": [
        {
            "id": 130,
            "templateId": 1472,
            "issueTypeId": "10400",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        },
        {
            "id": 131,
            "templateId": 1472,
            "projectId": 11100,
            "requestTypeId": 39,
            "serviceDesk": true,
            "transitions": []
        },
        {
            "id": 132,
            "templateId": 1473,
            "issueTypeId": "10401",
            "projectId": 11100,
            "serviceDesk": false,
            "transitions": []
        }
    ]
}

Manage transition screens in the Default Template configuration

This endpoint allows you to perform bulk updates to the Default Template’s settings in target projects. You can:

  • update the Transitions column in all projects that use the Default Template functionality
  • update the Transitions column only in specified projects
  • define projects that will be ignored from the update

POST

This method will check in each project which screen is connected to the initial transition in the workflow, and it will set it accordingly in the Default Template’s configuration for a given pair of a template and an issue type, but only if such a configuration exists under the project. If the project does not have any default template configured, it will be skipped.

Note

In most cases, you will be setting the transition to Create, which by default has the ID=1. In case of any problems, double-check if the Create transition indeed has the ID=1 in your workflow.

Method

POST /rest/api/it/1.0/default-template/transition/1

Example

Request body:

{
  "ignoreProjectKeys": [
    "BFPT", "BFT", "DIC", "DFT", "JASD", "TEMP", "HT"
  ],
  "includeProjectKeys": [
    "ITT"
  ]
}

Response:

{
    "updatedDefaultTemplates": 2,
    "updatedProjects": [
        "ITT"
    ],
    "skippedProjects": [
        "HT"
    ],
    "errorMessages": []
}

Definitions

Parameter Definition
includeProjectKeys A list of project keys of the projects that will be updated. If no value is given, all project will be included in the update.
ignoreProjectKeys A list of project keys of the projects that will not be updated. If no exclusions are needed, it’s enough to send an empty list.

Default Template configuration before the change:

Issue Templates for Jira - Issue Templates for Jira - Set the transition screen in the Default Template configuration: Before the change
Issue Templates for Jira - Set the transition screen in the Default Template configuration: Before the change

Default Template configuration after the change:

Issue Templates for Jira - Issue Templates for Jira - Set the transition screen in the Default Template configuration: After the change
Issue Templates for Jira - Set the transition screen in the Default Template configuration: After the change

DELETE

With this method you can remove all transition screens from the Default Template’s configuration. You can:

  • delete the Transitions column in all projects that use the Default Template functionality
  • delete the Transitions column only in specified projects
  • define projects that will be ignored from the update

Method

DELETE /rest/api/it/1.0/default-template/transition

Example

Request body:

{
  "ignoreProjectKeys": [
    "ADAST", "BFPT", "BFT", "DIC", "DFT", "JASD", "PMS",
    "TEMP", "HT"
  ],
  "includeProjectKeys": [
    "ITT"
  ]
}

Response:

{
  "updatedDefaultTemplates": 3,
  "updatedProjects": [
    "ITT"
  ],
  "skippedProjects": [
    "HT"
  ],
  "errorMessages": []
}
Need help?

If you can’t find the answer you need in our documentation, raise a support request.