Create issue via API with labels

Warren Levy Community Champion Nov 06, 2017

I am trying to use the REST API to create an issue in Jira, which is something that I've had working successfully for ages, but the difference is I'm trying to put in labels as well.

The JSON below (without labels) to create an issue works perfectly :

{{
"fields": {
"project": {
"key": "DS"
},
"summary": "Updating of scripts from Sprint",
"description": "",
"issuetype": {
"name": "Task"
},
"customfield_12702": "3d",
"timetracking": {
"originalEstimate": "3d"
}
}
}}

 

but the same JSON with a few added lines for labels :

{{
"fields": {
"project": {
"key": "DS"
},
"summary": "Updating of scripts from Sprint",
"description": "",
"issuetype": {
"name": "Task"
},
"customfield_12702": "3d",
"timetracking": {
"originalEstimate": "3d"
},
"labels": [
"Testing",
"Automation"
]
}
}}

gives me an error 400 : Bad request.

Has anyone successfully created an issue with labels? What am I doing wrong?

1 answer

1 accepted

Accepted Answer
1 vote

Your labels syntax. Could you verify that you've got "labels" on the screens for project DS and issue type Task? 

Warren Levy Community Champion Nov 06, 2017

Hi Kian

If I open a Task the labels field is on the main page, similar to Task Type, Priority, Status etc.

It ISN'T on the Create screens - is this the issue?

Thanks for your response

Warren Levy Community Champion Nov 06, 2017

Thanks Kian

I added the labels field to a create screen and it works now

Hi Warren,

I am also facing same problem now and could you please help me how did you resolve for yourcase?

Warren Levy Community Champion Jan 11, 2018

As I stated above. The labels field needed to be on the Create screen

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

422 views 7 5
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you