Is there a way to add a value to a single choice list using python? I'm looking for a simple python script using either the Jira module or the api. I have the custom field ID and the context ID, but I'm not finding how to add the custom field option. I tried the following api update example script from the , but the script throws an error.
url = "https://bogus.atlassian.net/rest/api/3/field/customfield_1111/context/00000/option"
auth = HTTPBasicAuth(username, token)
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
payload = json.dumps( {
"options": [
{
"disabled": false,
"value": "RHEL 8.9"
}
]
} )
response = requests.request(
"POST",
url,
data=payload,
headers=headers,
auth=auth
)
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
Response:
Traceback (most recent call last):
File "./updateChoices.py", line 41, in <module>
"disabled": false,
NameError: name 'false' is not defined
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.