I would like to update a particular project using the API (Python).
I have tried to run the API call as specified below and the code runs without errors. However, the specified field is not updated.
Anyone who experienced the same problem. Would appreciate a code (obviously without the credentials & IDs) that worked. My guess is that I have the error in my body definition.
Thanks in advance.
BR,
Bálint
projects_api_instance = asana.ProjectsApi(api_client)
body = {"data":{"Custom fields":{"Product description [VBGC]": "Hello world,}}}
opts = {"same options as in the official example"}
try:
# Update a project
api_response = projects_api_instance.update_project(body, project_gid,opts=opts)
pprint(api_response)
except ApiException as e:
print("Exception when calling ProjectsApi->update_project: %s\n" % e)
It looks like the issue is with the request body format. If you check our API Reference and select Shell as the language in the right-hand panel, you’ll see that the custom_fields parameter is expected to be a dictionary, where:
The keys are custom field GIDs
The values are either strings (for text/number fields) or GIDs (for enum options or other object-based fields)
Here’s a simple example of a valid request body for this endpoint: