Google Tasks API: How can I find the TaskList of a Task?

1.6k views Asked by At

Google Tasks API:
I have the ID of a Task.
The user changes the TaskList of the Task.
How can I find the new TaskList?

Fetching all TaskLists and then going through all the tasks takes ages.
Is there no other way?

2

There are 2 answers

2
pinoyyid On BEST ANSWER

Disclaimer: I haven't tested this

To get a task, you need the tasklist ID and the task ID GET https://www.googleapis.com/tasks/v1/lists/tasklist/tasks/task

So if you list all of the tasklists, then try to get the task id from each in turn, I think that's your quickest method.

0
Anthony Graglia On

With Tasks items, the only way I have found so far to find the list it belongs to is to parse the 'selfLink' property of the item.

Like stated in the accepted answer, https://www.googleapis.com/tasks/v1/lists/tasklist/tasks/task is the format and you need to grab 'tasklist' which should be the id of the list that the item belongs to.