Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Unable to update customfield using python, however it work well using curl

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 '' \
--header 'Authorization: Bearer <token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"fields": {"customfield_16220":[{"name": ""}]}}

 python code:


import requests
import json


url = ""
payload = {"fields": {"customfield_16220":[{"name": ""}]}}

headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer " + access_token

response = requests.request('PUT',url, headers=headers, data=payload, verify=False)

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?

1 answer

1 accepted

0 votes
Answer accepted

Try using

response = requests.request('PUT',url, headers=headers, json=payload, verify=False)

The difference is, when using the json argument, you're sending a JSON serializable python object instead. 

Thank you @Prince Nyeche . It resolved my issue.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events