API filter by due_on


#1

I am looking to get all the task that are Due_on 2017-06-01 (this will be all the task on the calendar [complete or incomplete] for that day.

The code I thought would work for this is:
curl -H “Authorization: Bearer <personal_access_token>” “https://app.asana.com/api/1.0/projects/9891147345427/tasks?due_on=2017-06-01&opt_pretty=true&opt_fields=name,due_on,Custom_fields&limit=10

I will get a reply but the result is not filtered.


#2

Hey @Blake_Hickman,

I think that is not possible to filter the tasks by due date as I can read from the documentation (https://asana.com/developers/api-reference/tasks#query). You have to get them all (using projects or tasks endpoint) and filter the results by yourself.


#3

@Blake_Hickman I will start out by saying I hire people to create the programs that I use the API for. I also don’t know the format you are looking for and whether you use a PC. Having said that I used the Advanced Search combined with my CSV To PDF utility that I contributed to the Community. CSV To Asana Simple List Generator- My Gift To Community

Here was the results. Probably not what you are looking for but thought I would mention it.Task Due Date Certain.pdf (16.8 KB)


#4

I feel like this should be a basic function. From what I understand, I can create a custom field and use that to filter my records. For example, if I have a custom field called Date and the value is a text value, I would do something like date=“06/01/2017” and it should filter. If I can do that with a custom field, why can I not do that with a built-in field like due_on?


#5

Thanks but I am trying to filter the data as much as I can before it hits my SQL server (I know I know, I can filter it there, but that’s not what I want to do :slight_smile:)


#6

I have no idea about the queries based on Custom Fields but many advanced queries are missing from tasks endpoint.

I hope Asana add in the near future, the client advanced search functionality to the API.

Maybe someone else knows a non-documented way to do this.


#7

Hi guys,

Unfortunately, @Diakoptis is correct, this filter is not implemented - neither documented nor in our code :frowning2: so the only recourse at this time is to filter it client-side. @Blake_Hickman is also right in that I agree with the statement “I feel like this should be a basic function.” The challenge here is with

If I can do that with a custom field, why can I not do that with a built-in field like due_on?

Well, you can’t pull that query off in our API either, only in our web app, for what it’s worth :grin:. The reason that this doesn’t just come out of the box is that the underlying infrastructure for our in-app search is different than that of the rest of the app - this is actually pretty common, for example, Apache Lucene and Amazon ElasticSearch are examples of such systems. While this is how our search works, we haven’t taken advantage of this anywhere in our API yet.

But…

Our API team has definitely been thinking about this and capturing all the search and filtering use cases (I forwarded this one on!) to help define what that would look like in our API. We haven’t built it out yet, so I don’t have a date to share but it’s definitely fresh in our minds!