I've build an API client based on Guzzle that since version 3.4.2 adds an utf-8 charset to the Content-Type header. With this header the Asana API returns a 400 Bad Request error, while without the charset things work fine.
This doesn't work on POST and PUT requests:
Content-Type: application/x-www-form-urlencoded; charset=utf-8
This works:
Content-Type: application/x-www-form-urlencoded;
Using curl as the simplest example :
This one fails:
curl -u {apikey}: https://app.asana.com/api/1.0/projects -d "name=Test" -d "notes=Test." -d "workspace={workspace-id}" --header "Content-Type: application/x-www-form-urlencoded; charset=utf-8"
Returns a 400 Bad Request with this output :
{"errors":[{"message":"Request data must be a JSON object, not null"}]}
This one succeeds:
curl -u {apikey}: https://app.asana.com/api/1.0/projects -d "name=Test" -d "notes=Test." -d "workspace={workspace-id}" --header "Content-Type: application/x-www-form-urlencoded;"
This returns a 201 created with the data that was send.
This happens for other POST and PUT requests as well. Is this a bug in the Asana API or expected behaviour?
(I work at Asana.) We've verified this is a bug. The fix should be live in the next day or so. Thanks for reporting!