Date error with API

I’m trying to run this API call:

https://app.asana.com/api/1.0/workspaces/123456789/tasks/search?completed=true&sort_by=created_at&sort_ascending=true&opt_fields=gid,created_at,assignee,assignee_status,completed,completed_at,custom_fields,due_on,modified_at,projects,tags&created_on.after=2015-02-11T21:00:34.889Z

However every time I run it I get this error:
created_on.after: Date must be in ISO-8601 (yyyy-mm-dd) format, not: 2015-02-11T21:00:34.889Z

It’s not a problem with authentication or anything else because if I remove the created_on.after parameter, the query works fine. I’ve tried using encodeURIComponent to encode the url but the exact same thing happens. What am I doing wrong?

Try using

as the date. If that works, the rest of your date is not ISO-8601. But online validators say the date is correct though… :thinking:

I’m trying to pull a large list of tasks so I’m following the instructions in the pagination section of the Search tasks endpoint at this URL: https://developers.asana.com/docs/#search-tasks-in-a-workspace
So I’m getting the timestamp from Asana in the previous call and iterating through the listing 100 records at a time. As such, I’d expect the timestamp to be valid (and it is). That’s also the reason I can’t remove the timestamp portion, as that would defeat the purpose.
Could this be a big with the API?

I’ll share my own code later today!

@Gabe_Priyev and @Bastien_Siebman,

Isn’t the solution just to change:

&created_on.after=2015-02-11T21:00:34.889Z

to:

&created_at.after=2015-02-11T21:00:34.889Z

Thanks,

Larry

2 Likes

Indeed, that is what I am using created_at.before. Good catch

1 Like

That was it! Thank you for the quick response!

2 Likes