Unrecognized request field `collaborators` when posting to asana api for adding collaborators to a task

I’m using Asana API for the first time. What i’m doing is posting the data to the asana-api using python requests library
ASANA-API

url = “https://app.asana.com/api/1.0/tasks/1234/addCollaborators
headers = {“Authorization”:“Bearer 12345678”}
data = {“collaborators”:[191563290920498]}
d =json.dumps(data)
response = requests.post(url,data = d ,headers= headers,verify = False)

Error is
{u’errors’: [{u’message’: u’Unrecognized request field collaborators. The only allowed keys at the top level are: data, options, auth. Is it possible you did not wrap object properties in a data object?‘, u’help’: u’For more information on API status codes and how to handle them, read the docs on errors: Build an app with Asana’}]}

can someone please tell me what am i doing wrong ?? Thanks

It looks like you may have forgotten quotation marks around the collaborators ID. Try:

data = {"collaborators":["191563290920498"]}

2 Likes