I'm trying to add a non existent value to a drop down with empty list. Please check my code below and please let me know what is lacking.
I am following this documentation but I couldn't get it working.
def add_value():
url = "https://company.atlassian.net/rest/api/3/field/customfield_10000/option"
auth = HTTPBasicAuth(user, token)
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
payload = json.dumps( {
"options": [
{
"disabled": "false",
"value": "Scranton"
},
{
"disabled": "true",
"value": "Manhattan"
},
{
"disabled": "false",
"value": "The Electric City"
}
]
})
response = requests.request(
"POST",
url,
headers=headers,
auth=auth
)
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
=====
Error:
{
"errorMessages": [
"No content to map to Object due to end of input"
]
}
Yeah! Context/contextid is the key!
Updated code.
Made changes on the response variable,
response = requests.request(
"POST",
url,
data=payload,
headers=headers,
auth=auth
)
It's still not working:
Error:
{
"errorMessages": [],
"errors": {
"value": "value is required"
}
}
Is the context/{contextID} required?
url = "https://your-domain.atlassian.net/rest/api/3/field/{fieldId}/context/{contextId}/option"
How am I going to identify or where am I going to get the context id?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.