0

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?

Christopher Masser
  • 809
  • 13
  • 25

2 Answers2

1

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.

pinoyyid
  • 21,499
  • 14
  • 64
  • 115
  • Thanks, this works. However, if you have many TaskLists there will also be many API calls. They probably have it all in one table on the server. Why can't there be a simple search function? – Christopher Masser Dec 01 '13 at 17:52
  • 1
    To reduce the http calls you could try batching them https://developers.google.com/storage/docs/json_api/v1/how-tos/batch and https://code.google.com/p/google-api-java-client/wiki/Batch. it might give you a small win. – pinoyyid Dec 02 '13 at 03:45
0

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.

Anthony Graglia
  • 5,355
  • 5
  • 46
  • 75