Skip to main content

Google Drive Component

Manage files in Google Drive

Component key: google-drive

Description#

Google Drive is Google's cloud storage for work and home. This component allows you to create, copy, download, update, list, and delete files stored in a Google Drive Account.

Documentation for the Node.js client used in this component can be found at https://developers.google.com/drive/api/v3/quickstart/nodejs.

A common integration pattern involves listing files in a file store, and performing a series of actions on the array of files that are returned. See our looping over files quickstart for information about how to create a loop over an array of files.

Authorization Notes#

The Google Drive component authenticates requests through Google's OAuth service. To create a Google Drive developer account and authenticate using Google OAuth, follow directions here Now, you will have to configure OAuth 2.0 settings in Prismatic. Create a new credential of type OAuth 2.0 - Authorization Code.

  • For Client ID and Client Secret enter the values that you got from the Google Cloud Platform auth settings.
  • For Scopes choose from the list found on the Google docs
  • For Authorization URL enter https://accounts.google.com/o/oauth2/auth
  • For Access Token URL enter https://oauth2.googleapis.com/token

Google Drive Connections#

OAuth2#

InputKeyDefaultNotes

Authorize URL

string
/ Required
Hidden Field
authorizeUrlhttps://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consentThe Authorization URL for Google Drive.

Client ID

password
/ Required
clientIdThe Google Drive app's Client Identifier.

Client Secret

password
/ Required
clientSecretThe Google Drive app's Client Secret.

Scopes

string
/ Required
scopeshttps://www.googleapis.com/auth/driveSpace delimited listing of scopes. https://developers.google.com/identity/protocols/oauth2/scopes#drive

Token URL

string
/ Required
Hidden Field
tokenUrlhttps://oauth2.googleapis.com/tokenThe Token URL for Google Drive.

Actions#

Copy File#

Copy a file by file id | key: copyFile

InputKeyNotesExample

Connection

connection
/ Required
connectionThe Connection to use for authorization.

File ID

string
/ Required
fileIdA unique opaque ID for each file. File IDs are stable throughout the life of the file, even if the file name changes.my-example-file-id

File Name

string
fileNameProvide a string for the name of the new file.myFile

Folder ID

string
folderIdA unique opaque ID for each folder.my-example-folder-id

Output Example Payload#

{  "data": {    "config": {},    "data": {      "type": "Buffer",      "data": [        101,        120,        97,        109,        112,        108,        101      ]    },    "status": 404,    "statusText": "error",    "request": {      "responseURL": "www.example.com"    }  }}

Create File#

Create a new file with content and metadata | key: createFile

InputKeyNotesExample

Connection

connection
/ Required
connectionThe Connection to use for authorization.

File Content

string
/ Required
fileContentThe binary or text body of the file. Some content examples you can store in Google Drive are images, videos, text, and PDF.My Example File Contents

File Name

string
fileNameProvide a string for the name of the new file.myFile

Folder ID

string
folderIdA unique opaque ID for each folder.my-example-folder-id

Output Example Payload#

{  "data": {    "config": {},    "data": {      "type": "Buffer",      "data": [        101,        120,        97,        109,        112,        108,        101      ]    },    "status": 404,    "statusText": "error",    "request": {      "responseURL": "www.example.com"    }  }}

Create Folder#

Create a directory file | key: createFolder

InputKeyNotesExample

Connection

connection
/ Required
connectionThe Connection to use for authorization.

Folder Name

string
/ Required
folderNameProvide a string for the name of the new folder.Pictures

Output Example Payload#

{  "data": {    "config": {},    "data": {      "type": "Buffer",      "data": [        101,        120,        97,        109,        112,        108,        101      ]    },    "status": 404,    "statusText": "error",    "request": {      "responseURL": "www.example.com"    }  }}

Delete File#

Delete a file by file id | key: deleteFile

InputKeyNotesExample

Connection

connection
/ Required
connectionThe Connection to use for authorization.

File ID

string
/ Required
fileIdA unique opaque ID for each file. File IDs are stable throughout the life of the file, even if the file name changes.my-example-file-id

Output Example Payload#

{  "data": {    "config": {},    "data": {      "type": "Buffer",      "data": [        101,        120,        97,        109,        112,        108,        101      ]    },    "status": 404,    "statusText": "error",    "request": {      "responseURL": "www.example.com"    }  }}

Empty Trash#

Empty the trash of deleted files | key: emptyTrash

InputKeyNotes

Connection

connection
/ Required
connectionThe Connection to use for authorization.

Output Example Payload#

{  "data": {    "config": {},    "data": {      "type": "Buffer",      "data": [        101,        120,        97,        109,        112,        108,        101      ]    },    "status": 404,    "statusText": "error",    "request": {      "responseURL": "www.example.com"    }  }}

Get About#

Gets information about the user's Drive, and system capabilities | key: getAbout

InputKeyNotes

Connection

connection
/ Required
connectionThe Connection to use for authorization.

Output Example Payload#

{  "data": {    "config": {},    "data": {      "type": "Buffer",      "data": [        101,        120,        97,        109,        112,        108,        101      ]    },    "status": 404,    "statusText": "error",    "request": {      "responseURL": "www.example.com"    }  }}

Get File#

Gets a file's metadata and content by ID. | key: getFile

InputKeyNotesExample

Connection

connection
/ Required
connectionThe Connection to use for authorization.

File ID

string
/ Required
fileIdA unique opaque ID for each file. File IDs are stable throughout the life of the file, even if the file name changes.my-example-file-id

Output Example Payload#

{  "data": {    "type": "Buffer",    "data": [      69,      120,      97,      109,      112,      108,      101    ]  }}

List Files#

Lists all available files and directories | key: listFiles

InputKeyNotesExample

Connection

connection
/ Required
connectionThe Connection to use for authorization.

Page Size

string
pageSizeProvide an integer value for the maximum amount of results that will be returned. Provide a value from 1 to 50.20

Page Token

string
pageTokenSpecify the pagination token that's returned by a previous request to retrieve the next page of resultslslTXFcbLQKkb0vP9Kgh5hy0Y0OnC7Z9ZPHPwPmMnxSk3eiDRMkct7D8E

Output Example Payload#

{  "data": {    "config": {},    "data": {      "type": "Buffer",      "data": [        101,        120,        97,        109,        112,        108,        101      ]    },    "status": 404,    "statusText": "error",    "request": {      "responseURL": "www.example.com"    }  }}

Update File#

Updates a file's content by file id | key: updateFile

InputKeyNotesExample

Connection

connection
/ Required
connectionThe Connection to use for authorization.

File Content

string
fileContentThe binary or text body of the file. Some content examples you can store in Google Drive are images, videos, text, and PDF.My Example File Contents

File ID

string
/ Required
fileIdA unique opaque ID for each file. File IDs are stable throughout the life of the file, even if the file name changes.my-example-file-id

File Name

string
fileNameProvide a string for the name of the new file.myFile

Output Example Payload#

{  "data": {    "config": {},    "data": {      "type": "Buffer",      "data": [        101,        120,        97,        109,        112,        108,        101      ]    },    "status": 404,    "statusText": "error",    "request": {      "responseURL": "www.example.com"    }  }}