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

1 votes

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

Veeravel I'm New Here Jan 11, 2018

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,760 views 11 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot