dojogeorge
dojogeorge

Reputation: 1704

Asana API - get all tasks and completion status

I am trying to use the Asana API to get all tasks within a project, as well as whether they have been completed. This seems to require the use of the opt_expand parameter, but I am having no luck with the following URL (and combinations of it): https://app.asana.com/api/1.0/projects/XXXX/tasks?limit=10&fields=completed&opt_expand=completed. Is this possible with the Asana API currently?

Upvotes: 2

Views: 1157

Answers (1)

Jeff
Jeff

Reputation: 456

You need to use the opt_fields parameter in your GET request. Asana does not support generalized queries like completed=true. However, you can query for all tasks for a particular project and then filter the tasks by their completed_at value. The completed_at field will return a read-only time (e.g.'2012-02-22T02:06:58.147Z') of when the task was completed or null if the task is incomplete.

To return all tasks related to a project, including if they are complete, use this GET request: /projects/XXXX/tasks?opt_fields=name,completed_at.

For your reference, you can specify the options you want returned by using the parameters outlined in the Asana Input/Output Option docs. Also make sure to read the Asana Tasks docs to see which fields are available for the task resource.

Upvotes: 3

Related Questions