0

I am looking for limit parameter by which I can limit the the data that I am get. Like I want to get the list of tasks. By which I can get the list of task.

https://www.googleapis.com/tasks/v1/lists/{{tasklist_id}}/tasks?maxResults=50&order=date

But here I got the recently 50 tasks, but when I call this url I must get the data after last data received. So if there any since parameter by which I can limit the response and my data would not loss please let me know.

abraham
  • 46,583
  • 10
  • 100
  • 152
Mahendra Garg
  • 516
  • 1
  • 9
  • 27

2 Answers2

1

There is no limit parameter. there is only max results and max results is more like per page.

If a request will return 100 rows, and you place maxresults 50 then the first response you will get back will contain 50 rows. You will have to make a second request to get the next 50.

Google tasks.list returns a response

{
  "kind": "tasks#tasks",
  "etag": string,
  "nextPageToken": string,
  "items": [
    tasks Resource
  ]
}

This is a response for the request made at this exact time. If you had sent maxresults 50 and 100 rows would be returned then you use NextPageToken to get the next 50 rows for this request.

If after you run that request new records arrive into the system those records will not come in the previous request because that is the data built at the time the request was sent.

Example:

I make a request against the API. I set max rows to 1

1, test
2, test2 
3, test3

the API will return to me 1, test with a nextPageToken I can use to get the next set of results. I make a request using the NextPageToken I get 2, test2

If while I am looping though these NextPagetokens a new row arrives 4, test4 I will not see this because it wasn't part of the result set of my initial query.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • Ok fine. If suppose 100 rows created I got 50 rows in a 1st call. after 1st call another 50 more row created, so it will return me the latest 50 rows in another call, So here I lost my remaining 50 rows data. SO here I lost my imp data. – Mahendra Garg Sep 17 '15 at 09:34
  • https://www.googleapis.com/tasks/v1/lists/{{tasklist_id}}/tasks?maxResults=50&order=date <-- that is one request it returns 100 rows (NOW) if new data arrived in that time then its a different request and you will have to make another request to get the newer data after the initial request was made. – Linda Lawton - DaImTo Sep 17 '15 at 09:39
  • You did not get me . I'm saying that. If I make this request googleapis.com/tasks/v1/lists{{tasklist_id}}/tasks?maxResults=5&or‌​der=date and at the time of request another 10 task created, so I will return the latest 5 task. and if again I made request then no new task I'll get. So I lost here my 5 task data – Mahendra Garg Sep 17 '15 at 10:23
  • then you will get 5 rows back the first request then you use nextpagetoken to get the next 5 rows, .... – Linda Lawton - DaImTo Sep 17 '15 at 10:25
  • what is nextpagetoken? How can I use it? – Mahendra Garg Sep 17 '15 at 10:26
  • The total number of rows returned by a single request is the number of rows that are there at the time you make the request. it doesn't matter if there comes more rows there will still only be 100 rows. – Linda Lawton - DaImTo Sep 17 '15 at 10:26
  • nextPageToken string Token used to access the next page of this result. – Linda Lawton - DaImTo Sep 17 '15 at 10:27
  • can you give me an example of using next page token in my request? – Mahendra Garg Sep 17 '15 at 10:27
  • check the documentation there are examples in java, php, python and .net https://developers.google.com/google-apps/tasks/v1/reference/tasks/list Nextpagetoken is normally just a url yo should just be able to execute it using the accesstoken – Linda Lawton - DaImTo Sep 17 '15 at 10:31
  • Why I am not getting NextpageToken In my response? – Mahendra Garg Sep 17 '15 at 10:37
  • because there aren't anymore rows. – Linda Lawton - DaImTo Sep 17 '15 at 10:37
0

Tasks: list supports a updatedMin parameter with a RFC 3339 timestamp which will restrict the returned tasks to those that were updated since that time.

https://www.googleapis.com/tasks/v1/lists/{{tasklist_id}}/tasks?maxResults=50&order=date&updatedMin=2015-09-17T15:52:20Z
abraham
  • 46,583
  • 10
  • 100
  • 152