Vinaya-hub / google-api-objectivec-client

Automatically exported from code.google.com/p/google-api-objectivec-client
0 stars 0 forks source link

Changes list return the entire list of changes even if maxresult = 1 #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I need to make a dummy request just to receive the largestChangeID, so I make a 
request to the list changes 
(https://developers.google.com/drive/v2/reference/changes/list) with maxResult 
1 to just obtain the largestChangeID. 

1. Execute a request with no need of paginate the results (for example set 
maxResult = 1)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
GET https://www.googleapis.com/drive/v2/changes?maxResults=1&key={YOUR_API_KEY}

Authorization:  Bearer 
ya29.AHES6ZSZzp5Asp02vdKmAiNbCs1cuvBFxvy2L3g8Mae05uDrABIBtTs
X-JavaScript-User-Agent:  Google APIs Explorer
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

2. The request contains no items, but a nextPageToken is returned (This must be 
a defect in the API). 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
{
 "kind": "drive#changeList",
 "etag": "\"GesfazbRwXf_7avgrxTp0sjPQkU/BAblAFB_YsAZHzKV9V2HFOof83U\"",
 "selfLink": "https://www.googleapis.com/drive/v2/changes?maxResults=1",
 "nextPageToken": "4",
 "nextLink": "https://www.googleapis.com/drive/v2/changes?maxResults=1&pageToken=4",
 "largestChangeId": "2870",
 "items": [
 ]
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

3. GTLServiceDrive should have shouldFetchNextPages = YES

What is the expected output? What do you see instead?

The expected result it's just the one I can see in the raw response. 
Instead as a pageToken is present in the response, GTLServiceDrive start 
fetching all the next pages retrieving the entire list of changes in the 
account. 

I think that the problem is the API returning a nextPageToken when no necessary.

Original issue reported on code.google.com by p...@archyapp.com on 9 May 2013 at 5:16

GoogleCodeExporter commented 9 years ago
The service probably has its shouldFetchNextPages property set. Be sure to turn 
that off for the service or the ticket.

https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Result_
Pages

Original comment by grobb...@google.com on 14 May 2013 at 12:20

GoogleCodeExporter commented 9 years ago
Basically maxResults is a kind of "max results for page", it make sense. 
Is there a request I can make to retrieve only the changeID?

Original comment by p...@archyapp.com on 15 May 2013 at 3:20

GoogleCodeExporter commented 9 years ago
The Drive API allows query (q) parameters to specify what gets returned. See 
the DriveSample app and Drive API documentation and discussion areas for more 
details.

Original comment by grobb...@google.com on 15 May 2013 at 10:55

GoogleCodeExporter commented 9 years ago
Makes sense, thanks.

Original comment by p...@archyapp.com on 21 May 2013 at 10:07