I'm using the Google Drives API for the first time and I cannot find anywhere how to use the API's pageToken
system. Below is a snippet of example code taking directly from googles web editor.
<script src="https://apis.google.com/js/api.js"></script>
<script>
/**
* Sample JavaScript code for drive.files.list
* See instructions for running APIs Explorer code samples locally:
* https://developers.google.com/explorer-help/guides/code_samples#javascript
*/
function execute() {
return gapi.client.drive.files.list({
"includeItemsFromAllDrives": true,
"orderBy": "name",
"pageSize": 1000,
"q": "'FOLDER_ID' in parents",
"supportsAllDrives": true,
"fields": "files(name,fileExtension,starred,size)"
})
.then(function(response) {
// Handle the results here (response.result has the parsed body).
console.log("Response", response);
},
function(err) { console.error("Execute error", err); });
}
gapi.load("client:auth2", function() {
gapi.auth2.init({client_id: "YOUR_CLIENT_ID"});
});
</script>
<button onclick="authenticate().then(loadClient)">authorize and load</button>
<button onclick="execute()">execute</button>
Currently, the code above, only returns 1000 files. According to the documentation it should also include a nextPageToken
, but the example code does not return that token.
What am I doing wrong here?