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

Server/Data Center

Cloud

8.x
7.x
FAQ
Release notes
Last updated Aug 27, 2020

REST API

This page provides REST API methods for Issue Templates.

REST API methods allow you to perform several actions within the Issue Templates app. All possible actions are listed in the right-hand side navigation menu.

Info

Create issues from template

This section shows how to create an issue from template using REST API.

Request

curl -D- -u admin:admin -X POST --data {see below} -H "Content-Type: application/json" http://localhost:8080/rest/api/2/issue

Response

     {"fields": {
        "project":
        {
           "key": "EXMP"
        },
        "summary": "Issue created from REST.",
        "issuetype": {
           "name": "Bug"
        },
        "customfield_10000" : "7"
      }
  

Configure default templates

This section shows how to configure a default template using REST API.

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 Service Desk), together with the issue types’ configuration.

See a list of available endpoints below:

Get By Project

Request

GET /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 /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 /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 /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 /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 /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 /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 /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 /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 /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 /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 /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": []
        }
    ]
}

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 Desk.
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.

Need help?

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

*Include as much information as possible to help our support team resolve your issue faster.