Created
April 15, 2015 21:02
-
-
Save nickmalcolm/776d3b46108445fac70e to your computer and use it in GitHub Desktop.
The code we use to paginate through results.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
result = @client.execute api_method: @client.drive.files.list, parameters: { | |
q: "trashed=false and mimeType != 'application/vnd.google-apps.folder'", | |
pageToken: page_token, | |
fields: "etag,items(etag,sharingUser,writersCanShare,thumbnailLink,lastModifyingUser,alternateLink,indexableText,owners,id,modifiedByMeDate,description,embedLink,folderColorRgb,thumbnail,downloadUrl,originalFilename,iconLink,editable,exportLinks,mimeType,createdDate,modifiedDate,headRevisionId,lastViewedByMeDate,webViewLink,fileExtension,webContentLink,labels,fileSize,quotaBytesUsed,markedViewedByMeDate,userPermission,defaultOpenWithLink,videoMediaMetadata,appDataContents,imageMediaMetadata,permissions,kind,version,ownerNames,copyable,parents,title,properties,selfLink,shared,lastModifyingUserName,openWithLinks,sharedWithMeDate,md5Checksum,explicitlyTrashed),kind,nextLink,nextPageToken,selfLink" | |
} |
See http://stackoverflow.com/questions/27892623/google-drive-file-resource-is-missing-permissions-data for why we define the fields in full
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@client
is set up earlier, with an Customer's OAuth token. Onlypage_token
changes, as we iterate through pages, and that comes from theresult
'snextPageToken
.This code works fine for ~1500 pages, but for no apparent reason will return a 500 response.