In the latest Google Drive API update, they want us to provide them with a resourceKey, when we want to access the Google Drive shared link. They said they put the resource key in the metadata of the files, but when I get the metadata of the files, there is no resourceKey attribute in there. So, do you guys know how to get the resourceKey of the file?
Metadata request code :
$fileID = substr($url,strpos($url,'=')+1,33);
$metadata=\Illuminate\Support\Facades\Storage::disk("google")->getMetaData($fileID);
Related
I would like to integrate Google Drive with my private website in such way that user will provide my website with his own Google Drive, and he could perform on my website such actions as: viewing, deleting, adding or editing files. Is is possible? What is needed to do such integration?
I read Google Drive API documentation and I checked it is possible to perform such actions as creating, reading, editing files. But I have no idea how to perform it on someones else private Google Drive.
The first thing you need to understand is that drive api is a rest api the response is returned in Json format. The google drive api is not going to give you any visual representation of a users drive account. For example your not going to be able to show them the google drive web application from your website. You will need to code the interface yoruself.
As for how to get permission we use something called Oauth2 to request consent for your application to access the users google drive account. It can be a little confusing in the beginning but there are a number of tutorials and QuickStart's which should help you get started.
I am attempting to verify that I have successfully copied a bunch of photos from google photos to onedrive. I can programmatically get the sha1 hash of each file stored in OneDrive but I don't see the same option from the google photos rest api. I would have expected it to be in the metadata: https://developers.google.com/photos/library/reference/rest/v1/mediaItems#MediaMetadata
It also doesn't look like the stored photos are exposed through the Google Drive api, so how do I get the hash?
You can get the MD5 Checksum for the files stored on Google drive with the Drive API.
However, there is no way to get the SHA1 hash for files without downloading them.
Also, there is no way to get either of those with the Google Photos API.
Yes you can without downloading the photos - check rclone (listing as jsons returns the hashes)
https://rclone.org/commands/rclone_lsjson/
https://rclone.org/googlephotos/
I am looking to use the Box.com API to download a file. Their API documentation shows that a file_id is required to call the API endpoint. However, I cannot find how to obtain the file_id. How do you obtain the file_id if all you have is the file name?
Along the same lines what if the file is located in a specific directory within the Box.com user's account. Can you obtain the file_id from a given path?
You can find a Box file id by searching for the file by name using the Box API Search endpoint.
I need listing all files of 'My Drive', but only the files and folders which are immediately below, not all the ones in the Drive at once.
Thanks for your help,
Mario
I suggest to use files.list API method.
Set q parameter on:
'root' in parents and trashed = false
What it means you can find on the page: Search for Files. You can test API methods on the APIs Explorer Drive API v2 page.
Please, see also:
Getting a list of files by folder on Drive SDK.
The api's for SkyDrive and Dropbox have options for managing the user's entire drive. For Google Drive, the drive.file scope seems to give only access to the files created by the app.
Is there a scope for Google Drive that gives access to the entire drive?
Edit: The below answer was correct, but the latest version of the Drive API allows requesting of a full scope with https://www.googleapis.com/auth/drive. The Documents List API is no longer needed for this use case. See https://developers.google.com/drive/scopes#requesting_full_drive_scope_for_an_app
To be precise the Drive API gives access to Files created by the app and files that the user has opened with the app from the Drive UI (through open-with).
To manipulate all of the Drive files of the user you can use the Google Document List API . Though we currently forbid Drive applications (the ones that have get integrated in the Drive UI through the Open-with and Create dialogs) to request access to the Document List API as we want to keep Drive application on a per-file security model. (Basically adding the Document List scope in the Drive SDK settings raises an error).