New endpoint: project task counts

Hello all! With the growing set of high-level reporting and planning features Asana has been adding to our web app (timeline, portfolios, workload) we’ve decided to bring some additional high-level reporting functionality to the API: project task counts. When you view a list of projects in a portfolio or view a project’s “Progress” tab, you can see a count of complete and incomplete tasks and milestones in that project, and those counts are now in the API!

Specifically, by hitting GET /projects/<project-gid>/task_counts you can get six different counts for that project:

{
  "num_tasks": 150,
  "num_incomplete_tasks": 100,
  "num_completed_tasks": 50,
  "num_milestones": 10,
  "num_incomplete_milestones": 7,
  "num_completed_milestones": 3
}

A few things to note about this endpoint:

  • All fields are opt-in. You’ll need to use the opt_fields parameter to select which counts you want. Like the rest of our API, we encourage you to select only the fields you need.
  • This endpoint has a separate rate limit. You will be limited to 60 requests per minute, similar to the search API. These fields also count fairly high against our cost limits, so you should only opt-in to the fields you truly need.
  • Milestones are included in task counts. Milestones are a subtype of tasks, and so num_tasks and other task counts also include counts of milestones. In the above example, there are 150 tasks in the project, of which 140 have resource_subtype: "default_task" and 10 have resource_subtype: "milestone".

Take a look at our docs for more information. Happy reporting!

1 Like

That’s great news, will be useful to show our customers why the app seems slow fetching data, when we know that a project have 25000 tasks.
Can these new fields be returned by you while paging, on the first page?
I mean, if I query for /projects/xyz/tasks, when I receive the first page with the “paging offset”, can we also receive the “total count” to have an idea of how many page we’ll need to query?
If not, I’ll certainly add a query to these new task_counts when I detect a huge project that needs paging.

Unfortunately, we cannot make these counts part of our pagination systems. They only apply to these few specific categories (completed/incomplete/total tasks/milestones in a project) and would not work when, for example, using modified_since to filter the tasks, or when making queries for other kinds of objects in the API.