issue.add_field_value fails to add a version string to the collection
swordfish0x0 opened this issue · 1 comments
Bug summary
using Jira python library 3.5.2
I'm attempting to add a version to the versions list and this fails.
The code can successsfully get the issue ticket...
issue = jira.issue(TICKET_ID)
get the versions..
x = issue.get_field('versions')
Now...if I call
issue.add_field_value('versions', ADD_THIS_VERSION_STR)
This call fails with a thrown error message
response text = {"errorMessages":[],"errors":{"versions":"Could not find valid 'id' or 'name' in version object."}}
The docs and comments say takes a string and a string
see https://jira.readthedocs.io/api.html#jira.resources.Issue.add_field_value
says: " add_field_value(field: str, value: str)
Add a value to a field that supports multiple values, without resetting the existing values.
This should work with: labels, multiple checkbox lists, multiple select"
Is there an existing issue for this?
- I have searched the existing issues
Jira Instance type
Jira Server or Data Center (Self-hosted)
Jira instance version
8.20.19
jira-python version
3.5.2
Python Interpreter version
3.9
Which operating systems have you used?
- Linux
- macOS
- Windows
Reproduction steps
from jira import JIRA
...
issue = jira.issue(TICKET_ID)
..
get the versions..
x = issue.get_field('versions')
...
Now...if I call
This call fails
issue.add_field_value('versions', ADD_THIS_VERSION_STR)
Throws error message:
response text = {"errorMessages":[],"errors":{"versions":"Could not find valid 'id' or 'name' in version object."}}
Stack trace
File "C:\Program Files\Python39\lib\site-packages\jira\resources.py", line 712, in add_field_value
super().update(fields={"update": {field: [{"add": value}]}})
File "C:\Program Files\Python39\lib\site-packages\jira\resources.py", line 324, in update
r = self._session.put(self.self + querystring, data=json.dumps(data))
File "C:\Program Files\Python39\lib\site-packages\requests\sessions.py", line 647, in put
return self.request("PUT", url, data=data, **kwargs)
File "C:\Program Files\Python39\lib\site-packages\jira\resilientsession.py", line 246, in request
elif raise_on_error(response, **processed_kwargs):
File "C:\Program Files\Python39\lib\site-packages\jira\resilientsession.py", line 71, in raise_on_error
raise JIRAError(
Expected behaviour
the issue.add_field_value should work and add the value to the list or docs should be updated to explain correctly how to use this api.
Additional Context
No response