Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top