Mysterious asana task 400 API request

Hey all,

So I have our server add tasks to users on asana, it’s great, works great.

Nothing’s changed in my code but I’m now getting a mysterious error when calling the new task asana API:

Server returned HTTP response code: 400 for URL: https://app.asana.com/api/1.0/tasks

Here’s the output:
{“errors”:[{“message”:“Could not interpret as an identifier in .”,“help”:“For more information on API status codes and how to handle them, read the docs on errors: Build an app with Asana”}]}

I’ve read the link of course, to no avail. It’s suggesting that it’s a bad request.

Here’s the exact POST request (I replaced numbers with numbers, letters with letters for privacy, without changing any other characters.

projects=1234&workspace=1234&name=Transfer+%2430.00+for+chatid+594446&due_on=2018-08-28&notes=PAYMENT+from+asdf+team%3A+firstname+lastname.+For+chat%3A+asdf+asdf+Topup.+You+should+make+a+bank+transfer+of+30.00+to+the+asdf+bank+account+with+description%3A+asdf+Chatid+594446.&assignee=1234&collaborators[0]=1234&

The error message seems mysterious, can anyone assist? I can see there’s a double space between “interpret” and “as”, and there’s a space between “in” and “.” in the response.

Would anyone be able to shed any light?

Thanks!
Andrew

Hi @Andrew_QPay, it looks like you have a trailing & at the end of your request body. This is not compliant with the spec for form-encoded data, where the syntax specifies that & must only exist as a separator between key-value pairs. We recently changed our HTTP server library to one that is more strict and surfaces more errors like this, which is why you haven’t been seeing this in the past. (Unfortunately, the point at which we capture this error is incorrect, which is why the error message is cryptic. I’ve filed a bug to improve where this is caught and provide a better message.) If you remove the trailing &, your requests should start working again.

2 Likes

Absolute champion. It worked.

Thanks so much!

2 Likes