Hi all,
I have some code to create a JIRA ticket via a REST API call. I can create the ticket with mandatory field values successfully, but when I try to add labels, the process complete, with blank values in the labels field. The label field does appear on the create screen, FYI.
This is the line I'm using:
"labels": ["BTS","lhf"]
Do you know why the labels are not getting created when the ticket is created?
Thanks for the advice!
Hi @Digit Harris ,
welcome to the Atlassian Community!
The label field needs to be on the create screen. Please, try to add it and test again. Thank you.
Hi Hana!
Thanks for the welcome!
The label field does already exist 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.
Oh, I'm very sorry. I read your description as "The label field does NOT appear on the create screen".
Labels field is optional, right?
According to documentation this
"labels": [ "bugfix", "blitz_test" ],
seems ok :-).
But I will try it myself during the day and let you know.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Digit Harris ,
I've just tested creating issue with labels and it worked for me. Those were my test payloads (xxx needs to be replaced by valid account id):
{
"update": {},
"fields": {
"summary": "My test issue",
"issuetype": {
"id": "10002"
},
"project": {
"id": "10000"
},
"description": "My test description",
"reporter": {
"id": "xxx"
},
"priority": {
"id": "3"
},
"labels": [
"bugfix",
"blitz_test"
],
"assignee": {
"id": "xxx"
}
}
}
{
"update": {},
"fields": {
"summary": "My test issue",
"issuetype": {
"id": "10002"
},
"project": {
"id": "10000"
},
"description": {
"type": "doc",
"version": 1,
"content": [{
"type": "paragraph",
"content": [{
"text": "My test description",
"type": "text"
}]
}]
},
"reporter": {
"id": "xxx"
},
"priority": {
"id": "3"
},
"labels": [
"bugfix",
"blitz_test"
],
"assignee": {
"id": "xxx"
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To be honest, I'm out of ideas, where the problem could be. I even tried to play with the issue layout, but the field is always filled.
Did you try to create issue with labels in another project to determine, whether there's problem only with one project or whether it is something global?
Maybe try to also use some service like RequestBin to get the information, how does the request looks like and if the data for labels field are really sent and correct.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for taking a look at it, Hana. I'll try RequestBin and see if that makes a difference, but I'm not hopeful. I tried using a service in ServiceNow, and it was successful. It just doesn't work when I convert it to javascript. My gut tells me the issue has to do with the fact that the label field is an array, because I can get all other fields to populate correctly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Digit Harris ,
when I try to send some invalid data for the labels field, I get error message: "data was not an array"
So if you are able to create the issue, but labels are not there, it seems to me there are only two possibilities:
"labels": [],
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.