Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Cannot create tickets while adding labels using the REST API

Brian Smith January 30, 2013

I am trying to create tickets with labels. The statement below works fine without labels, where the errors occur. There must be an issue with how I am structuring labels.

curl -i -X POST -H "Content-Type: application/json" -d '{"fields":{"project":{"key":"QA"},"summary":"'$SUMMARY'","description":"'$DESCRIPTION'","labels":[{"add":"GB0.3"},{"add":"GoBig"}],"issuetype":{"name":"Test Procedure"}}}' -u ${USER_NAME}:${PASSWORD} http://jira.chacha.local/rest/api/2/issue/

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Brian Smith January 30, 2013

I figured it out on my own.

curl -i -X POST -H "Content-Type: application/json" -d '{"fields":{"project":{"key":"QA"},"summary":"'$SUMMARY'","description":"'$DESCRIPTION'","issuetype":{"name":"Test Procedure"},"labels":["GB0.3","GoBig"]}}' -u ${USER_NAME}:${PASSWORD} http://jira.chacha.local/rest/api/2/issue/

0 votes
Luis Mayora
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.
January 30, 2013

Do you know if the labels are allowed on the Edit Issue Screen?

Brian Smith January 30, 2013

Yes, I can create all the labels I want.

Luis Mayora
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.
January 30, 2013

I havent't used this Restful API but i remember using SOAP Service API and i remember doing something like this.

RemoteFieldValue remoteLabel = new RemoteFieldValue { id = "customfield_id", values = ""}.

Did you try using ...

[{"customfield_id_for_label":"GB0.3"},{"customfield_id_for_label":"GoBig"}]

Brian Smith January 30, 2013

This is the error I recieve with the changes you asked me to try and with my original statement above.

{"errorMessages":[],"errors":{"labels":"string expected at index 0"}}

Luis Mayora
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.
January 30, 2013
TAGS
AUG Leaders

Atlassian Community Events