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?
Your labels syntax. Could you verify that you've got "labels" on the screens for project DS and issue type Task?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Kian
I added the labels field to a create screen and it works now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As I stated above. The labels field needed to be on the Create screen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am new to JIRA API. Could you please post your code so that I understand where exactly to insert the labels code? Where is Create screen option?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Amit
A sample JSON file is posted at the top of this page which shows what is required to create an issue with labels included.
For the cloud based Jira, go to Project settings, then choose Screens and click on the "Screen" link for Create issue. Then ensure that labels shows, or add if not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.