Listing tasks with all the fields

client.projects.tasks("PROJECTID").then (function(collection) {
   console.log(collection.data)
})

The above API call give me this array format:
{
gid: ‘1158369472918073’,
name: ‘new task’,
resource_type: ‘task’ }

I’m looking to return collection of tasks for targeted project. For every task i would like to return additional field such as description, comments, assignee, attachment …etc.

Try something like:

client.projects.tasks("PROJECTID", {opt_fields: "assignee,projects"})
  .then (function(collection) {
   console.log(collection.data)
})

Look at the “get a task” sample for a list of available opt_fields.
https://developers.asana.com/docs/#get-a-task

@Frederic_Malenfant thank you. i see it. it’s missing the comments part though.

Comments are special type of Stories. You need to do another query to get stories, task by task. You can’t get them directly from the “get tasks by project”. I suggest to keep a cached copy of these stories, and compare the “updated_at” of each task to validate and refresh your cached stories.
https://developers.asana.com/docs/#asana-stories

1 Like

Thanks again.