0

I am currently using the Tasks API Java client in my Android app in this way:

List<Task> tasks = client.tasks()
    .list("@default")
    .setFields("items(title,notes,status,due)")
    .execute()
    .getItems();

But this only returns the tasks from the "Default" task list. Is there a way to get the tasks from all task lists, without having to get the lists from client.tasklists() and iterate through them?

Kyle
  • 1,070
  • 2
  • 13
  • 23

1 Answers1

1

Short answer: No.

As the documentation specifies, the list action "Returns all tasks in the specified task list".

The "restful" style is that all resources belong to a collection. As such, using list for Tasks requires acting it on a TaskList. As you noted, it's very simple to list all TaskLists, then list all Tasks from each TaskList and collect them in a list. Note that one might even argue that in many circumstances, a Task is meaningless when separated from the context of the list it was created in.

You can see the full Api Reference for Tasks API here.

Nick
  • 8,964
  • 4
  • 26
  • 37
  • 1
    This restful style is not very useful. A TaskList can be changed any time by the user. If you have a taskID and do not know the new TaskList-ID then there is no fast way of searching for the task. Going through all the tasklists and listing all the tasks is just ridiculously time-consuming. – Christopher Masser Dec 01 '13 at 15:55