Is it possible to revoke the sharing URL for a file with the Google Drive API after it has been created? I checked the docs but can't see anything relevant. I know it's possible with the DropBox and OneDrive APIs but it doesn't look like it can be done with Google.
You can use the delete operation in Google Drive API to revoke/delete access to a file.
HTTP Request should look like this:
DELETE https://www.googleapis.com/drive/v3/files/fileId/permissions/permissionId
You can explore the references below for further details about Google Drive API and DELETE operation.
Share files, folders and drives
Permissions: delete
Related
I am creating one application when users can use his/her drive account to save documents. Can i use Drive API so the users save documents in drive? The users will use my app to upload pdf documents in his/her folder.
Yes you can use the Google Drive api to create, update and delete files on a users google drive account.
You Will need to use Oauth2 to have the user authenticate your application granting it access to their google drive account.
You should be aware that the Google drive api has a number of sensitive and restricted scopes which will make the verification process a little more complicated than it would be otherwise.
What you need to know about Google verification in 2021.
I'm working on Google Drive app script and using the Advanced Drive Service.
And I want to get all users have edit permission of a file, is there any method like File.getEditors() of the build-in service.
You can use the Permissions.list endpoint.
I have a google drive where am storing few google sheets. My java web application is able to search a file that is present in my own google drive using Javascript API. Is there a way to search for a specific files in other's google drive via code? i will be getting the shareable link to the google drive am supposed to search. can this be done? As far as i checked this is not possible. Also there is no where in google document that says i can search files in other's drive. Kindly someone confirm.
This is an OAuth question, not a GDrive question.
The account that the GDrive API will apply to is determined by the Access Token that it is called with. So, if you can get an Access Token for somebody else's Drive, then you can use that to search their drive. How you would get such a token will depend very much on the details of your use case and the trust relationship.
My question is if it is not possible to copy a file from one folder in drive to another folder in drive with the google drive api if you only have the scopes "drive.file" and "drive.readonly"?
Tested using the API explorer: https://developers.google.com/drive/v2/reference/files/copy
The error is: "The authenticated user has not granted the app X write access to the file Y".
Creating a file (using the same scopes) and copying it is possible however.
Figured I ask and put the answer up since it's hard to find info about the google drive api.
It is possible but you also need the "drive.metadata" scope for it to work. You can ofc use the "drive" scope but that provides more access than needed.
is their a way to check by making an API call to google Drive that if a particular folder/file is Deleted?
use files.get() and look at the labels.trashed attribute.