-
Notifications
You must be signed in to change notification settings - Fork 134
Google Scripts
The desktop tool relies on the following Google Script endpoints for data retrieval. The endpoint URLs are hard-coded into the tool.
Deployed at: https://script.google.com/macros/s/AKfycbw90rkocSdppkEuyVdsTuZNslrhd5zNT3XMgfucNMM1JjhLl-Q/exec
This script returns the name and mime type of the Google Drive file specified in the id field of the POST request body.
There's no reason why this can't be a GET endpoint - I just haven't gotten around to switching it over after initially setting it up as a POST endpoint.
function doPost(e) {
return (function(id){
var file = DriveApp.getFileById(id);
return ContentService
.createTextOutput(JSON.stringify({
name: file.getName(),
mimeType: file.getBlob().getContentType()
}))
.setMimeType(ContentService.MimeType.JSON);
})(e.parameters.id);
}Deployed at: https://script.google.com/macros/s/AKfycbzzCWc2x3tfQU1Zp45LB1P19FNZE-4njwzfKT5_Rx399h-5dELZWyvf/exec
This script returns the base64 representation of the Google Drive file specified in the id field of the GET request body.
function doGet(e) {
return (function(id){
var file = DriveApp.getFileById(id);
var size = file.getSize();
var result = [];
if (size <= 30000000) {
result = file.getBlob().getBytes();
}
return ContentService
.createTextOutput(Utilities.base64Encode(result))
.setMimeType(ContentService.MimeType.TEXT);
})(e.parameter.id);
}Made with