Google Drive

Learn how to connect to Google Drive with Digibee Integration Platform and perform List, Download, Upload and Delete file operations.

Google Drive connects to your drive in Google Drive and perform List, Download, Upload and Delete file operations.

Parameters

Take a look at the configuration parameters of the component. Parameters supported by Double Braces expressions are marked with (DB).

Google Drive doesn't follow the same folders hierarchy. Therefore, it's not possible to make searches and specify a directory path. Example:

dir1/dir2/dir3/fileName.extension

Another detail about Google Drive is that you can save files with the same name in the same directory. That's why the API defined by Google uses the "fileId" to download or delete files instead of the file itself.

To perform any of these operations, it's necessary to register a OAuth 2 type account with "https://www.googleapis.com/auth/drive" scope.

Messages flow

List

Input

{
              "query": "'11HMcyPhqH4OpAVv7p0Ip1uNu-vGk0nKV' in parents",
              "pageSize": 5,
              "pageToken": null,
              "operation": "list",
              "failOnError":false
}

Output

[{
    "name": "REMOTE_FILE_NAME or REMOTE_FOLDER_NAME",
    isFolder: false,
    "fileId": "FILE_ID",
    "mimeType": "FOLDER OR FILE MIME_TYPE",
    "description": "FOLDER or FILE DESCRIPTION"
}]

Google Query Language

See some query examples:

To search all the files/folder inside a specific folder

"query": " 'FOLDER_ID' in parents "

To search files that have the same specific name inside a folder

"query": " 'FOLDER_ID' in parents and name = 'FILE NAME' "

To search a specific name inside all your Drive

"query": " name = 'FILE NAME' "

In the query above, the search will be made in your drive, including the Trash folder. If you don't want to search anything in the Trash folder, then use the following query:

"query": " name = 'FILE NAME' and trashed = false "

To search a specific file in 2 directories

"query": "'FOLDER_ID_1' in parents or 'FOLDER_ID_2' in parents and name = 'FILE NAME'"

Output

{
    "data": [{
        "name": "REMOTE_FILE_NAME or REMOTE_FOLDER_NAME",
        isFolder: false,
        "fileId": "FILE_ID",
        "mimeType": "FOLDER OR FILE MIME_TYPE",
        "description": "FOLDER or FILE DESCRIPTION"
    }],
    "pageToken": "PAGE_TOKEN",
    "success":true
}

Upload

Input

{ 
    "folderId": "11HMcyPhqH4OpAVv7p0Ip1uNu-vGk0nKV",              
    "fileType": "text/csv",              
    "remoteFileName": "test",              
    "operation": "upload",              
    "fileName": "test",              
    "failOnError":false  
}

Output

{              
    "folderId": "11HMcyPhqH4OpAVv7p0Ip1uNu-vGk0nKV",  
    "fileId": "FILE_ID_UPLOADED",              
    "remoteFileName": "test",              
    "fileName": "test",              
    "success":true  
}

Download

Input

{              
    "fileId": "FILE_ID",              
    "operation": "download",              
    "fileName": "test",              
    "failOnError":false  
}

Output

{              
    "fileId": "FILE_ID_UPLOADED",              
    "fileName": "test",              
    "success":true  
}

Delete

Input

{              
    "fileId": "FILE_ID",              
    "operation": "delete",              
    "failOnError":false  
}     

Output

{             
   "fileId": "FILE_ID_UPLOADED",             
   "success":true 
}

Last updated