API instructions
Google Developers - OAuth 2.0 Playground:
Step 1: Select & authorize APIs:
Step 2: Exchange authorization code for tokens:
- Click "Exchange authorization code for tokens".
Step 3: Configure request to API:
- Enter the "Request URI".
- Click "Send the request".
Request URI instructions
All files in folder
Get specific fields of files in a folder:
https://www.googleapis.com/drive/v3/files?q="folderId"+in+parents&fields=files(md5Checksum,+originalFilename,+size)
//
Replace "folderId" with the folder ID.
You can use &fields=files(*)
to get all of the file's fields.
Single file
Get specific fields of a file:
https://www.googleapis.com/drive/v3/files/fileId?fields=md5Checksum,+originalFilename,+size
//
Replace "fileId" with the file ID.
You can use &fields=*
to get all of the file's fields.
Parsing the JSON response
- Open a JavaScript console.
- Save the object into a variable.
- Map the object.
- Copy the result.
Code
var response = {
"files": [
{
"md5Checksum": "0cc175b9c0f1b6a831c399e269772661",
"originalFilename": "a.txt"
},
{
"md5Checksum": "92eb5ffee6ae2fec3ad71c777531578f",
"originalFilename": "b.txt"
}
]
};
var result = response.files.map(function (file) { return (file.md5Checksum + " *" + file.originalFilename); }).join("\r\n");
console.log(result);
copy(result);