Why can't I add labels to an issue via the REST API?

Whenever I try to create labels for a new issue (either when I'm creating it or after it's been created) I receive a 400 Bad Request response from the server and the following body:

{
    "errorMessages": [],
    "errors": {
        "labels": "Field 'labels' cannot be set. It is not on the appropriate screen, or unknown."
    }
}

Here's an example of how I'm attempting to add the label with a PUT request:

{ 
	"update": {
    "labels": [ {"add": "automated"} ]
	}
}

Again, I'm able to create issues just fine - and the labels field is displayed when attempting to create an issue through JIRA normally, so I'm sort of at a loss for why this could be happening.

2 answers

0 votes

Can you provide any more information? I am not having the same issue when I try the above string as the JSON request.

0 votes
Boris Berenberg Community Champion Apr 22, 2015

Try creating the issue via the UI with the user which is being used to auth. "Field 'labels' cannot be set. It is not on the appropriate screen, or unknown." is a pretty clear error, and you need to address why the user essentially does not see the field.

I agree that it is a clear error, but when I try to create the issue from the UI the labels field is clearly visible. I've attached a screenshot. This is the same user, same project, etc. If I send a GET request to the issue/createmeta and expand the fields for this project, I also see labels as valid. However, when I send the request either alongside the rest of the data to create the issue or update it after creation, I receive the above error. Can you think of anything else I should check?

labelcap.png

Suggest an answer

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

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

23,900 views 2 7
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