I am trying to set the labels field for a JIRA ticket in Python using the jira-python API.
With a valid JIRA issue object, created with issue = jira.issue(jira_ticket)
, I have tried the following:
issue.update(labels='AAA')
: gives a not on the appropriate screen
error as below.issue.update(fields={'labels':'AAA'})
: also gives a not on the appropriate screen
error as below.
issue.fields.labels.append(u'AAA')
: does not produce an error, but does not update field. I guess it updates the issue object, but doesn't push back to JIRA server.
I seem to always receive the error:
jira.exceptions.JIRAError: JiraError HTTP 400 url: https://someserver/rest/api/2/issue/nnnnnn
text: Field 'labels' cannot be set. It is not on the appropriate screen, or unknown.
This is the same error as this post, Python - JIRA - Modify Labels, but for different reasons - namely, labels are not turned off here, and I can set them with the web interface: See Image: JIRA Labels Added in Web UI and Image: updated JIRA issue with Labels.
If I dump out the raw fields for the issue in question, having added labels to it using the Web UI as above, then I can see the labels in the Python JIRA Issue object:
Field: 'labels', Value: ['StackOverflow', 'TAGTHATICANSEARCHFOR']
If anyone can point me in the right direction, it would be greatly appreciated.
After much digging around for an answer, it seems there is an ongoing problem with this.
It appears that I need to access labels manager to check issue labels and modify labels: https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-add-a-Label-with-Java-Rest-API/qaq-p/560837
There's an issue posted with Atlassian - vote it up: https://ecosystem.atlassian.net/browse/JRJC-109
Hopefully this helps someone if they find this post.