问题
Having an issue updating / modifying a JIRA issue's labels.
I've tried both of the below variations from the jira module documentation:
issue.update(labels=['AAA', 'BBB'])
OR
issue.fields.labels.append(u'new_text')
issue.update(fields={"labels": issue.fields.labels})
documentation
With the last example I'm getting this error:
JIRAError: JiraError HTTP 400
text: Field 'labels' cannot be set. It is not on the appropriate screen, or unknown.
url: https://jira.XXXXXXXXXX.com/rest/api/2/issue/XXXXXXXX
response text = {"errorMessages":[],"errors":{"labels":"Field 'labels'
cannot be set. It is not on the appropriate screen, or unknown."}}
Anyone have any recommendations?
Specs:
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
jira (0.50)
'rest_api_version': u'2'
回答1:
Well, I wrote that bit of the jira-python docs so I know it works. The problem as the error "It is not on the appropriate screen" suggests is that the standard Labels field is not on your Edit Screen configuration, or has been hidden in the field configuration being used by the project. Check you can edit the Labels field via the UI first.
回答2:
It is administration issue.
- You need administration rights for your Jira server, and log in.
- Go to your "Project" under configuration
- Go to "Screens" and
- Open and add filed 'Label' under appropriate Screens configuration: at least in 'Create issue' and 'Edit issue'
Now, you can add label in UI and through API also.
来源:https://stackoverflow.com/questions/32855906/python-jira-modify-labels