2

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?

dojogeorge
  • 1,674
  • 3
  • 25
  • 35
  • What do you mean by "having no luck?" What are you expecting to happen, and what is actually happening? – Chris Peters Jun 04 '16 at 15:04
  • I am attempting to return all tasks related to a project, and for each of those tasks whether it has been completed (ie returning a field completed, with a value of true or false, attached to each task) – dojogeorge Jun 04 '16 at 15:22

1 Answers1

3

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.

Jeff
  • 456
  • 2
  • 5