The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Deleted user
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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Andy Heinzer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
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

Deleted user
July 23, 2020

thanks Andy! this works!

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events