Wings2fly
Wings2fly

Reputation: 917

How to create JIRA issue ticket from a template using REST api?

I want to create JIRA Change Request Ticket using a template. I use JIRA API endpoint '/rest/api/2/issue'.

Below is the format of the data sent to JIRA.

Could anyone please help?

payload =
{ fields:
{ project: { key: "CRQ"},
customfield_15630: "SampleTemplateName",
summary: "Testing",
customfield_17679: "N.A" ,
customfield_14530:"2018-06-17T00:00:00.0+0000 ",
customfield_14531: "2018-06-17T00:00:00.0+0000 " } }

Here is the XML format of template I want to use in the issue ticket.

<item>
    <title>[TMPL-167] NTW-8 [Network_Interface_configuration]</title>
    <link>https://jiraqa.com/browse/TMPL-167</link>
    <project id="15980" key="TMPL">Templates</project>
    <description>Test</description>
    <environment />
    <key id="492895">TMPL-167</key>
    <summary>NTW-8 [Network_Interface_configuration]</summary>
</item>

Upvotes: 0

Views: 2732

Answers (1)

Dzmitry Hryb
Dzmitry Hryb

Reputation: 21

You are definitely lacking an issue type there. Here is an example of a proper issue creation using the REST API: https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/issue-createIssue Certain fields may be required or not depending on the project settings, but the project ID, the summary and the issue type are an absolute minimum.

Another thing is that you want to use a template in addition to this. Jira may simply not be able to automatically fetch the data from there, but if anything went wrong, you'd receive an error message anyway. Could you describe in more detail what exactly do you need to do? It would be easier to come up with a solution ;)

Upvotes: 1

Related Questions