It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Creating sub-task from an existing issue using API Edited

I know this has been asked countless of time. Unfortunately I still can't get it to work. So my apologies in advance. 

 

I'm trying to create a sub-task from an existing EPIC ticket which has a key value of ABC-123. My curl command is below. 

curl -D- -u user:user -X POST --data {"fields":{"project":{"key":"ABC-123"},"summary":"Sub-task of ABC-123","description":"Don't forget to do this too.","issuetype":{"id":"5"}}} -H "Content-Type:application/json" https://localhost:8080/rest/api/2/issue

 

..and this is the error I'm getting

{"errorMessages":["Unexpected character ('f' (code 102)): was expecting double-quote to start field name\n at [Source: org.apache.catalina.connector.CoyoteInputStream@5db919f1; line: 1, column: 3]"]}

1 answer

1 accepted

0 votes
Answer accepted

Hello @mb cebrian 

Welcome to the community.

Can you try this code below :

{
    "fields":
    {
        "project":
        {
            "key": "TEST"
        },
        "parent":
        {
            "key": "TEST-101"
        },
        "summary": "Sub-task of TEST-101",
        "description": "Don't forget to do this too.",
        "issuetype":
        {
            "id": "5"
        }
    }
}

 

Look if your issuetype id for subtask is correct. The project key in your code look wrong for me. The parent is missing too.

 

Hope this helps

hello. how do I get the correct issuetype id?

Hello,

here the doc to find the issuetype id:

https://confluence.atlassian.com/jirakb/finding-the-id-for-issue-types-646186508.html

 

But you can try this:

issuetype={"name":"Story"}

instead of :

"issuetype":
        {
            "id": "5"
        }

Hope this helps 

Thanks @Mohamed Benziane 

I was able to get it to work. Worth noting as well that I had to enclose 

{"fields":{"project":{"key":"TEST"},"parent":{"key":"TEST-101"},"summary":"Sub-task of TEST-101","description":"Don't forget to do this too.","issuetype":{"id":"5"}}} with single quote.  

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you