How to count a number of completed tasks between start and end date that I designate??

First of all, as I said above in title, I wanna count the number of completed tasks in a workspace by assignee.

Then as a trial, I hit GET request to this URL and the result has been returned but they are not filtered by completed=“true”. If it was successful, I thought I could count the number by using .length method.

https://app.asana.com/api/1.0/tasks?workspace=1200781712370361&assignee=1200781652740141&opt_fields=name,completed,completed:true,completed_at

Hi @Hiroshi_Nishio and welcome to the forum,

I think the Search API will be a better fit for your use case, as it allows for filtering results.

2 Likes

The search api is what you need.

Just 1 thing, if you filter by “assigne”, and completed_at between 2 dates, you will get tasks completed between these dates, and assigned to users X,Y.

But, if someone else completed the task, you will need to read the field “completed_by”, to make sure the assignee is the one who also completed the task.

That is also real, if users X or Y completed tasks assigned to someone else that is not in your filter.

2 Likes

Thank you guys.

Speaking of search api, as I understand it, it is a plan that can be used if the user subscribes to a paid premium plan, right?

We are developing a mini service/api that will be used by users, and we want them to be able to use it without having to subscribe to a premium plan, so hopefully we can solve this problem without using search Api!

Right, it does require the authenticating user be on a paid plan.

Then you’ll need to get all of the tasks as you were showing in your initial post, and do any needed filtering (for completed tasks, etc.) on your end in your own code.

Thank you for clarifying above, I will do that on my own.

1 Like