Unable to create Subtask-REST API-Client Account is required

Dragan Vucanovic February 23, 2018

curl -D- -u user:pass -X POST --data "{\"fields\":{\"project\":{\"key\":\"TECH\"},\"parent\":{\"key\":\"TECH-456\"},\"summary\":\"Test ChargenNr\",\"description\":\"some description\",\"issuetype\":{\"id\":\"10102\"}}}" -H "Content-Type:application/json" https://compnay.com/rest/api/2/issue/

Issue type 10102 is not a sub-task but a parent is specified."

 

when setting any other ID-valid issue type is required

 

I manually created subtask, here is part

 

 

"subtasks": [
                    {
                        "fields": {
                            "issuetype": {
                                "avatarId": 10316,
                                "description": "The sub-task of the issue",
                                "iconUrl": "https://jira.corp.hentsu.com/secure/viewavatar?size=xsmall&avatarId=10316&avatarType=issuetype",
                                "id": "10101",
                                "name": "Sub-task",
                                "self": "https://jira.corp.hentsu.com/rest/api/2/issuetype/10101",
                                "subtask": true
                            },

 

 

 

 

What's wrong ?

 

 

 

 

 

 

1 answer

0 votes
Warren
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 Leaders.
February 23, 2018

Hi Dragan

In your curl statement, you have 

"issuetype":{"id":"10102"}

but you need "name":"Sub-task" as per your manually created, then it should work 

Dragan Vucanovic February 23, 2018

Thanks Warren, now got:

 

customfield_10107":"Client Account is required

Dragan Vucanovic February 23, 2018

Finally works !!

"customfield_10107": {
                    "id": "10400",
                    "self": "https://company.com/rest/api/2/customFieldOption/10400",
                    "value": "user Internal"
                },

 

so final code:

 curl -D- -u user:password-X POST --data "{\"fields\":{\"project\":{\"key\":\"TECH\"},\"parent\":{\"key\":\"TECH-456\"},\"summary\":\"Test ChargenNr\",\"description\":\"some description\",\"issuetype\":{\"name\":\"Sub-task\"},\"customfield_10107\":{\"id\":\"10400\"}}}" -H "Content-Type:application/json" https://jira.corp.comany.com/rest/api/latest/issue/

 

This customfield is not mentioned anywhere in JIRA documentation

 

 

 

 

 

Suggest an answer

Log in or Sign up to answer