Get list of closed tasks with specific tag for particular date


#1

Hi there!

I tried to get list of tasks using API that have specific tag. This is endpoint I used.

https://app.asana.com/api/1.0/tasks?tag=406335922888596&completed_since=2017-08-10

This return task that are not closed.

I only need this functionality to get a count for particular date.

Can it be done?


#2

Hi @Vlada_Petrovic,

If you want to find tasks with a particular tag, you need to use the tags/tag_id endpoint:

GET /tags/123456789/tasks?completed_since=2017-08-14T02:06:58.158Z

Also, note that the timestamp must be in ISO-8601 format, not just yyyy-mm-dd.


#3

Jeff,

Thanks for the response. Your example returns the same response as one I used. I have two tasks with this tag. One is completed the other is not. API returns both. completed_since is useless. Don’t know why is called completed if it’s not working as the name suggests.

Is there any other way of returning just completed tasks with the specific tag?

btw: yyyy-mm-dd is also ISO-8601 format and it works just fine with the API call.


#4

Unfortunately, we don’t have the sort of filtering in our API where you can query to a subset of tasks that match an arbitrary pattern that you specify (i.e. “only completed tasks that were completed since a specified date”). We also don’t have an easy way to only get the completed tasks. You can get all incomplete tasks fairly easily by specifying completed_since=now on the tasks query endpoint. This is admittedly a bit strange, but works, however, the converse (get only tasks completed by a specific date) doesn’t exist. Per the task query docs, completed_since returns tasks that are either incomplete or that have been completed since this time. There is no way to return just the completed tasks.

We are evaluating adding more filitering to the API, so you might see it at some point!n For now, however, the only way to go about this is to get all the tasks and filter out the incomplete ones on your side.


#5

I hope you add more! Selecting only completed tasks can be useful. Also, allowing to search by task name (or notes (or even stories would be ultimately cool)) can prove pretty useful. It’s not I’m too lazy to do client-side filtering, but overall it’s probably lighter for the server-side and the bandwidth.