Getting completed tasks

Hi,

I have a trouble regarding asana API.

I have to search for completed tasks.

I request the API throught

https://app.asana.com/api/1.0/tasks?assignee=XXX&workspace=XXX&=opt_fields=completed,name&completed=true&limit=10 and some task in the json body have

completed: false

Has anyone notice this behavior ?

1 Like

I’m looping in our Developer Relations Lead, @Matt_Bramlage, to see if he can help troubleshoot! :slight_smile:

1 Like

Hi @waghanza,

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 the tasks where completed=true”). 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 - which is admittedly a bit strange, but works - but its converse (get only completed tasks) doesn’t exist :confused:

We are evaluating use cases for this sort of thing, though, so you might see it at some point! 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.

3 Likes

It would be great to be able to filter to completed state, or get the completed flag in the result of /projects/project-id/tasks, which currently only just gives id and name.

Use case would be for a simple statistics app that monitors progress accross a number of projects.
I’ve worked around it now by retrieving the flag from each individual task withing the project, but this makes the process very slow and requires a lot of API requests for larger projects.

4 Likes

Hey @Lennart,

We’ve recently launched a Search API endpoint that allows you to do server-side task filtering. It’s similar to the advanced search in the web product. Hopefully, this helps with future projects.

Cheers!
Jeff

2 Likes