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 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

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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jun 14, 2018 in Jira Service Desk

How the Telegram Integration for Jira helps Sergey's team take their support efficiency to the bank

...+ reading Fantasy). The same is true for him at the bank he works for: Efficiency is key when time literally equals money. Read on to learn how Sergey makes most of the time he has by...

487 views 2 5
Read article

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