Getting key or id is required error message while creating sub-task using JIRA REST API

Rakesh Tyagi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 20, 2020

Hi team, 

I am getting the following error while trying to create a sub-task using JIRA REST API

 

URL: https://MYJIRA.atlassian.net//rest/api/2/issue/ 

REQUEST BODY:

{ "fields": { "project": { "key": "KEY" }, "parent": { "key": "2134" }, "assignee": { "emailAddress": "xyz@abc.com" }, "reporter": { "emailAddress": "xyz@abc.com" }, "issuetype": { "id":"ISSUEID" }, "summary": "Summary text" , "description": "Description Text" }}

 

Error:

{

"errorMessages": [ "At least one of 'id' or 'key' is required to identify an issue." ],

"errors": {}

}

 

1 answer

1 accepted

0 votes
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 23, 2020

Hi Rakesh,

I see that you're using Postman to try to create a subtask in your Jira Cloud site.  Given the error you are seeing here it would appear that Jira does not recognize that you have supplied either the issue id or the issue key.

When you create a subtask in Jira, there is a requirement that all subtasks have to have a parent issue.  So we have to tell Jira specifically which issue this subtask is a child of when it is created.  In your example, you have

"parent": { "key": "2134" },

But the issue key consists of both the project key + the issue number in that project.  So they tend to have a format of ABC-2134.  Try changing the payload to look something more like this:

{ "fields": { "project": { "key": "ABC" }, "parent": { "key": "ABC-2134" },  "issuetype": { "id":"10005" }, "summary": "Summary text" , "description": "Description Text" }}

Try that, if it doesn't work let me know what error you get back in response.

Cheers,

Andy

Rakesh Tyagi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 23, 2020

thanks Andy! this works!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events