Google Drive Plugin

Introduction

Push files to Google Drive using your Users Drive Account both as Base64 or File Type. The easiest way to allow your app to move data on its own.
Note: This is the OAuth version, your users will sign into their own Drive account's using the plugin then have access to their files.
Prerequisites
You must have a developer account with Google to interact with the plugin API. Create your development account at: https://console.cloud.google.com/home/dashboard and also enable Google Drive API in console.

Setting up the plugin

  • Click on the button "ENABLE API AND SERVICES" and add "Google Drive API"
Image without caption
  • After you add Google Drive API, return back to the “Credentials” page and click on the "Create credentials" button. In the drop down select the "Oauth Client id". When prompted select "Web application
Image without caption
Image without caption
  • To create the key, please configure as seen below. Copy the Generic redirect URI and paste it in the Google Settings. Pay attention to the latest fields which should be used, also set the authorized origins url from your app. After everything was configured, click Create.
Image without caption
Image without caption
  • After everything was created new pop-up with will appear, copy the keys from the opened popup and put them in the plugin settings in your app.
Image without caption
Image without caption
  • The plugin is set, now can be used for all the API Calls and Actions that the plugin provides.

Plugin Element

The plugin comes with Save to Drive Visual Element and FileUploader. Place the element on page and configure it.
Image without caption
Note: This element is optional to use. Please see the information on the element to understand it's usage
Image without caption

Plugin Data Calls and Actions

Plugin’s data calls

  • Get User Info - After the user logs in into your app with their Google account, you can access the user's Google ID, name, profile URL, and email address.
  • Search/Get Files - Use the call to search or get files.
  • Get Image from Drive - representing an image.
  • Children: list - Lists a folder's children. To list all children of the root folder, use the alias root for the folderId value.
  • Children: get - Gets a specific child reference.

Plugin’s actions

  • Upload a File (base64)
  • Upload a File
  • Create a Folder
  • Give Everyone Permission (Write)
  • Give Everyone Permission (Read)
  • Remove Everyone With Link Permission
  • Remove Permission Using ID
  • Give a User Permission (Write)
  • Give a User Permission (Read)
  • Give a User Permission (Commenter) (copy)
  • Update a User's Permission (Read)
  • Update a User's Permission (Write)
  • Delete File
  • Get File Info
  • Add File to Folder
  • Remove File From Folder
  • Get Image from Drive
  • Rename file
  • Children: delete
  • Children: insert

Parameters

fileId - The ID of the file.
mime type - The MIME type of the file. Google Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded. If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource.
file description - A short description of the file.
childId - The ID of the child.
enforceSingleParent - Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. If the child's owner makes the request, the child is removed from all current folders and placed in the requested folder. Any other requests that increase the number of the child's parents fail, except when the canAddMyDriveParent file capability is true and a single parent is being added.
permissionId - The ID for the permission

Changelogs

Update 05/04/21
Improvement
  • Added a new element uploader which will increase the speed of file uploads.
Update 23/02/23
  • Added "Get file from Drive" call

Demo to preview the settings