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
when running this curl command it works fine.
curl --request POST -H "Authorization: Bearer 12345678" https://app.asana.com/api/1.0/tasks/1234/addFollowers --data-urlencode "followers=191563290920498"
This works as expected but when using this code i'm getting error
url = "https://app.asana.com/api/1.0/tasks/1234/addFollowers"
headers = {"Authorization":"Bearer 12345678"}
data = {"followers":[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 `followers`. 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: https://asana.com/developers/documentation/getting-started/errors'}]}
The server response is 400,so there must be something wrong in the way i'm passing the data. I've no idea what i'm doing wrong.Any help is appreciated :)
I also have tried this implementation:-
response = requests.post(url,params=d ,headers= headers,verify=False)
in this case the error message is
{u'errors': [{u'message': u'Could not parse request data, invalid JSON', u'help': u'For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors'}]}
and the response code is <400>