Hi there,
I'm trying to update a custom field "customfield_16220" using python which is failing. It errors 400.
However, the curl works fine.
curl request:
curl --request PUT \
--url 'https://jira.xxxxx.com/rest/api/2/issue/cdc2-96' \
--header 'Authorization: Bearer <token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"fields": {"customfield_16220":[{"name": "r.a@dddd.com"}]}}
python code:
import requests
import json
cf='customfield_16220'
access_token="<token>"
url = "https://jira.xxxxx.com/rest/api/2/issue/cdc2-96"
payload = {"fields": {"customfield_16220":[{"name": "r.a@dddd.com"}]}}
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer " + access_token
}
response = requests.request('PUT',url, headers=headers, data=payload, verify=False)
print(response)
It returns error code 400. Error:
{"errorMessages": ["Unrecognized token 'fields': was expecting 'null', 'true', 'false' or NaN\n at [Source: org.apache.catalina.connector.CoyoteInputStream@4bc1dc14; line: 1, column: 8]"]}
Here I must tell you that the same python code with the "GET" request (without data) is working fine and that is returning the issue details.
Can you please help me here in updating the customfield?