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

Austin Parker April 22, 2015

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
Boris Berenberg
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 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.

Austin Parker April 22, 2015

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

0 votes
Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 22, 2015

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

Suggest an answer

Log in or Sign up to answer