Operations (sample payloads)
Main operations
Create a Google document
Create a blank Google document in yours or your teams' drive. Sample Input
\{
"access_token": "ya29.a0AWY7CklhO1J3M2V5cXVpbmVzLWFyZS1hd2Vzb21l",
"google_mime_type": "application/vnd.google-apps.spreadsheet",
"name": "Q2 Sales Report",
"description": "Quarterly sales report for Q2 2023",
"parents": [
"1AbCdEfGhIjKlMnOpQrStUvWxYz"
]
\}
Sample Output
\{
"kind": "drive#file",
"id": "1BcDeFgHiJkLmNoPqRsTuVwXyZ",
"name": "Q2 Sales Report",
"mimeType": "application/vnd.google-apps.spreadsheet"
\}
Create folder
Create a folder. Sample Input
\{
"name": "Project Documents",
"parents": [
"1ABC123DEF456GHI789"
]
\}
Sample Output
\{
"kind": "drive#file",
"id": "1XYZ987WVU654TSR321",
"name": "Project Documents",
"mimeType": "application/vnd.google-apps.folder"
\}
Create permission
Create permission for a file Sample Input Sample Output
\{
"kind": "drive#permission",
"id": "05778688203104290963",
"type": "user",
"role": "writer",
"allowFileDiscovery": false
\}
Delete file
Delete a file by specifying its ID. Sample Input
\{
"access_token": "ya29.a0AfH6SMBgYmLHJ7Q8K9Xn3tGwRxR1K-Zj5nZtCxWY3Ej_4KQZLlQYLLZ8jKhN7VhQqLX5O3Yk8fJ2m",
"file_id": "1Xj2K9lM3nOpQrStUvWxYzAbCdEfGhIjK"
\}
Sample Output
{
"deleted": true
}
Delete permission
Delete permission from a file Sample Input
\{
"access_token": "ya29.a0AfH6SMBgXd1u9KcH3fJ5rHzjzxIG_vJ8PxZv3ZJrZQQqWxS1zXHq9XE2j-5WPXwN8kJKmZH7Vj8",
"file_id": "1Aw3X5yZ7bC9dEfGhIjKlMnOpQrStUvWx",
"permission_id": "05123456789012345678"
\}
Sample Output
{
"deleted": true
}
Download file
Download a file by ID. Sample Input
\{
"access_token": "ya29.a0AWY7CkmhU8j_Xn2jH3xM5K9Tn6Y-abcdefghijklmnop",
"file_id": "1Abc123XYZ_FileID_Example",
"keep_original_extension": true
\}
Sample Output
{
"file": \{
"name": "quarterly_report.pdf",
"url": "https://drive.google.com/uc?id=1Abc123XYZ_FileID_Example&export=download",
"mime_type": "application/pdf",
"expires": 1623456789
\}
}
Download Google file
Export and download a Google file by ID. Use this if you want to export a Google Doc for use in other programs, like Microsoft Word or Excel. Sample Input
\{
"access_token": "ya29.a0AfH6SMBgYWqH7xK9mZjJQr_fL8aXz1qP3Kj5XvCzVj0Ij-k_3j8f9tK2r1QzO8qN",
"file_id": "1Abc123XyZ_9876defGHI5432JKLmnop",
"mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
\}
Sample Output
{
"file": \{
"name": "Project_Proposal.docx",
"url": "https://drive.google.com/uc?id=1Abc123XyZ_9876defGHI5432JKLmnop&export=download",
"mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"expires": 1623456789
\}
}
Duplicate file
Duplicate a file. Sample Input
\{
"access_token": "ya29.a0AfH6SMBgYmO3XzD1K_1Xn5jL8K9CwY-9JK2H...",
"file_id": "1Abc123XyZ_FileID_Example",
"name": "Duplicate_Report_Q2_2023.docx",
"parents": [
"1FolderID123"
],
"mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"description": "Duplicate of Q2 2023 report for review",
"starred": true
\}
Sample Output
{
"id": "1Def456UvW_DuplicateFileID_Example",
"name": "Duplicate_Report_Q2_2023.docx",
"kind": "drive#file",
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"starred": true,
"trashed": false,
"explicitlyTrashed": false,
"parents": [
"1FolderID123"
],
"spaces": [
"drive"
],
"version": "1",
"webViewLink": "https://docs.google.com/document/d/1Def456UvW_DuplicateFileID_Example/edit?usp=drivesdk",
"iconLink": "https://drive-thirdparty.googleusercontent.com/16/type/application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"hasThumbnail": true,
"thumbnailVersion": "1",
"viewedByMe": true,
"viewedByMeTime": "2023-06-15T10:30:00.000Z",
"createdTime": "2023-06-15T10:30:00.000Z",
"modifiedTime": "2023-06-15T10:30:00.000Z",
"modifiedByMe": true,
"owners": [
\{
"kind": "drive#user",
"displayName": "John Doe",
"me": true,
"permissionId": "05925286828481325939",
"emailAddress": "johndoe@example.com"
\}
],
"lastModifyingUser": \{
"kind": "drive#user",
"displayName": "John Doe",
"me": true,
"permissionId": "05925286828481325939",
"emailAddress": "johndoe@example.com"
\},
"shared": false,
"ownedByMe": true,
"capabilities": \{
"canAddChildren": false,
"canChangeViewersCanCopyContent": true,
"canComment": true,
"canCopy": true,
"canDelete": true,
"canDownload": true,
"canEdit": true,
"canListChildren": false,
"canMoveItemIntoTeamDrive": true,
"canReadRevisions": true,
"canRemoveChildren": false,
"canRename": true,
"canShare": true,
"canTrash": true,
"canUntrash": true
\},
"viewersCanCopyContent": true,
"writersCanShare": true,
"quotaBytesUsed": "5242880",
"isAppAuthorized": false
}
Get file details
Get details about a file by specifying its ID. Sample Input
\{
"access_token": "ya29.a0AfH6SMBgVmOu3X8J_kYz9Hl-fOKQZLW3_Xj5ZY1Kx8F_7vGJLY_Uj-QNQ5ZX8g",
"file_id": "1Zt3nOzQwDuEF5678ghIJKLmnopqrsTUV"
\}
Sample Output
{
"id": "1Zt3nOzQwDuEF5678ghIJKLmnopqrsTUV",
"name": "Project Proposal.docx",
"kind": "drive#file",
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"starred": false,
"trashed": false,
"explicitlyTrashed": false,
"spaces": [
"drive"
],
"version": "2",
"webViewLink": "https://docs.google.com/document/d/1Zt3nOzQwDuEF5678ghIJKLmnopqrsTUV/edit?usp=drivesdk",
"iconLink": "https://drive-thirdparty.googleusercontent.com/16/type/application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"hasThumbnail": true,
"thumbnailVersion": "1",
"viewedByMe": true,
"createdTime": "2023-05-15T09:30:00.000Z",
"modifiedTime": "2023-05-16T14:45:00.000Z",
"modifiedByMe": true,
"owners": [
\{
"kind": "drive#user",
"displayName": "John Doe",
"me": true,
"permissionId": "05925286828481325495",
"emailAddress": "johndoe@example.com"
\}
],
"lastModifyingUser": \{
"kind": "drive#user",
"displayName": "John Doe",
"me": true,
"permissionId": "05925286828481325495",
"emailAddress": "johndoe@example.com"
\},
"shared": true,
"ownedByMe": true,
"capabilities": \{
"canAddChildren": false,
"canChangeViewersCanCopyContent": true,
"canComment": true,
"canCopy": true,
"canDelete": true,
"canDownload": true,
"canEdit": true,
"canListChildren": false,
"canMoveItemIntoTeamDrive": true,
"canReadRevisions": true,
"canRemoveChildren": false,
"canRename": true,
"canShare": true,
"canTrash": true,
"canUntrash": true
\},
"viewersCanCopyContent": true,
"writersCanShare": true,
"quotaBytesUsed": "5242880",
"isAppAuthorized": false
}
Get permission
Get permission. Sample Input
\{
"access_token": "ya29.a0AWY7CkmvU8Xj2Zt4Ym5Ux_Uy9Ej3Kl1Mn2Op3Qr4St5Uv6Vw7Xy8",
"file_id": "1AbCdEfGhIjKlMnOpQrStUvWxYz",
"permission_id": "12345678901234567890",
"use_domain_admin_access": false
\}
Sample Output
\{
"kind": "drive#permission",
"id": "12345678901234567890",
"type": "user",
"emailAddress": "user@example.com",
"role": "writer",
"displayName": "John Doe",
"deleted": false
\}
Get start page token
Get the starting pageToken to use in list changes. Sample Input
\{
"access_token": "ya29.a0AWY7CkmhU8j_kJ2xM5JvHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"drive_id": "0ABCde1F2GhIiJkLmNoPqRsTuV",
"supports_all_drives": true
\}
Sample Output
\{
"kind": "drive#startPageToken",
"startPageToken": "10234"
\}
List changes
List the changes for a user or shared drive. Sample Input
\{
"access_token": "ya29.a0AfH6SMBgXhYZ1kJ2m3k_lK5tPz8J9x-9vLz...",
"page_token": "EAIaAA...",
"drive_id": "0AIxJ5Ue...",
"fields": [
"changes/type",
"changes/fileId",
"changes/file/name"
],
"include_corpus_removals": true,
"include_items_from_all_drives": true,
"include_permissions_for_view": "published",
"include_removed": true,
"restrict_to_my_drive": false,
"spaces": [
"drive",
"appDataFolder"
],
"supports_all_drives": true,
"page_size": 50
\}
Sample Output
{
"kind": "drive#changeList",
"nextPageToken": "EAIaAA...",
"changes": [
{
"kind": "drive#change",
"type": "file",
"changeType": "modify",
"time": "2023-05-15T10:30:45.123Z",
"removed": false,
"fileId": "1Pc2xVd...",
"file": \{
"kind": "drive#file",
"id": "1Pc2xVd...",
"name": "Project Proposal.docx",
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
\}
},
\{
"kind": "drive#change",
"type": "file",
"changeType": "delete",
"time": "2023-05-15T11:15:22.456Z",
"removed": true,
"fileId": "1ZxY3Wf..."
\}
]
}
List drives
List drives. Sample Input
\{
"access_token": "ya29.a0AWY7CklhO1J3M2V5cXJ0ZHJpdmVfYWNjZXNzX3Rva2Vu",
"q": "Marketing",
"use_domain_admin_access": true,
"limit": 50,
"page_token": "nextPageToken123"
\}
Sample Output
List files
Retrieve a list of files. Sample Input
{
"access_token": "ya29.a0AWY7CkmvU8j2X...",
"source": "user",
"order_by": [
\{
"key": "modifiedTime",
"direction": "descending"
\}
],
"query": "mimeType = 'application/vnd.google-apps.document'",
"name": "Project",
"spaces": [
"drive"
],
"fields": "files(id,name,mimeType,modifiedTime)",
"include_items_from_all_drives": true,
"supports_all_drives": true,
"limit": 50
}
Sample Output
{
"kind": "drive#fileList",
"nextPageToken": "~!!~AI9...FMDc",
"incompleteSearch": false,
"files": [
\{
"kind": "drive#file",
"id": "1Abc123XyZ...",
"name": "Project Proposal",
"mimeType": "application/vnd.google-apps.document",
"modifiedTime": "2023-06-15T14:32:18.000Z"
\},
\{
"kind": "drive#file",
"id": "1Def456UvW...",
"name": "Project Timeline",
"mimeType": "application/vnd.google-apps.document",
"modifiedTime": "2023-06-14T09:45:30.000Z"
\},
\{
"kind": "drive#file",
"id": "1Ghi789RsT...",
"name": "Project Budget",
"mimeType": "application/vnd.google-apps.document",
"modifiedTime": "2023-06-13T16:20:45.000Z"
\}
]
}
List permissions
List permissions. Sample Input
\{
"access_token": "ya29.a0AfH6SMBgXhKUzNQFGXPLhKlLZxSXHUGJPJQlZZKhHnTABLXXXXXXXXXXXXXXXXXXXX",
"file_id": "1Abc123XYZ_FileID_Example",
"supports_team_drive": true,
"use_domain_admin_access": false,
"limit": 50,
"page_token": "nextPageTokenExample123"
\}
Sample Output
List spreadsheets
A list of the currently authenticated user's spreadsheets Sample Input
{
"access_token": "ya29.a0AfH6SMBgXhYZ1234567890abcdefghijklmnopqrstuvwxyz",
"source": "user",
"limit": 50,
"order_by": [
\{
"key": "modifiedTime",
"direction": "descending"
\}
],
"query": "mimeType='application/vnd.google-apps.spreadsheet'"
}
Sample Output
{
"kind": "drive#fileList",
"nextPageToken": "pageToken123456",
"files": [
{
"kind": "drive#file",
"id": "1AbCdEfGhIjKlMnOpQrStUvWxYz12345",
"name": "Q4 Financial Report",
"mimeType": "application/vnd.google-apps.spreadsheet",
"starred": false,
"trashed": false,
"explicitlyTrashed": false,
"parents": [
"0BwC9876543210ZYXWVUTSRQPOnM"
],
"spaces": [
"drive"
],
"version": "15",
"webViewLink": "https://docs.google.com/spreadsheets/d/1AbCdEfGhIjKlMnOpQrStUvWxYz12345/edit?usp=drivesdk",
"iconLink": "https://drive-thirdparty.googleusercontent.com/16/type/application/vnd.google-apps.spreadsheet",
"thumbnailLink": "https://docs.google.com/spreadsheets/d/1AbCdEfGhIjKlMnOpQrStUvWxYz12345/edit?usp=drivesdk&ouid=123456789012345678901&rtpof=true&sd=true",
"viewedByMe": true,
"viewedByMeTime": "2023-05-15T14:30:00.000Z",
"createdTime": "2023-05-01T09:00:00.000Z",
"modifiedTime": "2023-05-15T14:30:00.000Z",
"modifiedByMeTime": "2023-05-15T14:30:00.000Z",
"owners": [
\{
"kind": "drive#user",
"displayName": "John Doe",
"photoLink": "https://lh3.googleusercontent.com/a-/AOh14Gj1234567890",
"me": true,
"permissionId": "05123456789012345678",
"emailAddress": "john.doe@example.com"
\}
],
"lastModifyingUser": \{
"kind": "drive#user",
"displayName": "John Doe",
"me": true
\},
"shared": true,
"ownedByMe": true,
"capabilities": \{
"canEdit": true,
"canComment": true,
"canShare": true,
"canCopy": true,
"canReadRevisions": true
\},
"viewersCanCopyContent": true,
"writersCanShare": true,
"permissions": [
\{
"kind": "drive#permission",
"id": "12345678901234567890",
"type": "user",
"emailAddress": "jane.smith@example.com",
"role": "writer",
"displayName": "Jane Smith",
"photoLink": "https://lh3.googleusercontent.com/a-/AOh14Gj0987654321",
"domain": "example.com",
"allowFileDiscovery": true
\}
],
"quotaBytesUsed": "1048576",
"isAppAuthorized": false
}
]
}
Move file
Move a file or folder into another folder. Sample Input
\{
"access_token": "ya29.a0AfH6SMBgYmO3X-KqtJ_9OYZ8HFZ3nZJ2Kj5X...",
"file_id": "1Abc123XYZ_FileID",
"destination_folder_id": "0BxC789PQR_FolderID"
\}
Sample Output
\{
"id": "1Abc123XYZ_FileID",
"name": "Important Document.docx",
"parents": [
"0BxC789PQR_FolderID"
]
\}
Update permission
Update permission for a file Sample Input
\{
"access_token": "ya29.a0AWY7CklhO1J3M2...",
"file_id": "1Abc123XYZ789_0defGHIjkl",
"permission_id": "05678901234567890123",
"role": "writer",
"remove_expiration": true,
"transfer_ownership": false,
"use_domain_admin_access": false,
"expiration_time": "2023-12-31T23:59:59Z"
\}
Sample Output
\{
"kind": "drive#permission",
"id": "05678901234567890123",
"type": "user",
"role": "writer",
"allowFileDiscovery": true
\}
Upload file
Upload a file. Sample Input
{
"access_token": "ya29.a0AfH6SMBgYhN3K8jVmN2rLHB-fX_pEj1W9qoUJx7vM-1hRqTNjp5EGqYhZV8JK5UZY",
"file": \{
"name": "sample_document.docx",
"content": "base64_encoded_file_content_here"
\},
"name": "Important Document",
"parents": [
"1Abc123XyZ_FolderID"
],
"description": "This is an important document for the project.",
"starred": true,
"custom_properties": \{
"project": "Alpha",
"department": "Marketing",
"version": "1.0"
\}
}
Sample Output
{
"id": "1ZXY987abc_FileID",
"name": "Important Document",
"kind": "drive#file",
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"starred": true,
"trashed": false,
"explicitlyTrashed": false,
"parents": [
"1Abc123XyZ_FolderID"
],
"spaces": [
"drive"
],
"version": "1",
"webViewLink": "https://docs.google.com/document/d/1ZXY987abc_FileID/view",
"iconLink": "https://drive-thirdparty.googleusercontent.com/16/type/application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"hasThumbnail": true,
"thumbnailVersion": "1",
"viewedByMe": true,
"viewedByMeTime": "2023-06-15T10:30:00.000Z",
"createdTime": "2023-06-15T10:30:00.000Z",
"modifiedTime": "2023-06-15T10:30:00.000Z",
"modifiedByMe": true,
"owners": [
\{
"kind": "drive#user",
"displayName": "John Doe",
"me": true,
"permissionId": "05925286828481325939",
"emailAddress": "johndoe@example.com"
\}
],
"lastModifyingUser": \{
"kind": "drive#user",
"displayName": "John Doe",
"me": true,
"permissionId": "05925286828481325939",
"emailAddress": "johndoe@example.com"
\},
"shared": false,
"ownedByMe": true,
"capabilities": \{
"canAddChildren": false,
"canChangeViewersCanCopyContent": true,
"canComment": true,
"canCopy": true,
"canDelete": true,
"canDownload": true,
"canEdit": true,
"canListChildren": false,
"canMoveItemIntoTeamDrive": true,
"canReadRevisions": true,
"canRemoveChildren": false,
"canRename": true,
"canShare": true,
"canTrash": true,
"canUntrash": true
\},
"viewersCanCopyContent": true,
"writersCanShare": true,
"quotaBytesUsed": "5242880",
"isAppAuthorized": false
}
DDL operations
List drives (DDL)
Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping
Sample Input
{
"access_token": "ya29.a0AfH6SMBgXhWnOtC1K_Qz3bJ5Ej-mN9vZLjfJ7cXhN8sKL3mZ1QY_3f8tG5OvY9Xn2Z6rJ8Hg"
}
Sample Output
{
"drives": [
\{
"id": "0AJ1XyMbC7FZaUk9PVA",
"name": "My Drive",
"kind": "drive#drive",
"mimeType": "application/vnd.google-apps.folder",
"driveType": "user"
\},
\{
"id": "0AJ1XyMbC7FZaUk9PVB",
"name": "Shared with me",
"kind": "drive#drive",
"mimeType": "application/vnd.google-apps.folder",
"driveType": "shared"
\},
\{
"id": "0AJ1XyMbC7FZaUk9PVC",
"name": "Team Drive",
"kind": "drive#drive",
"mimeType": "application/vnd.google-apps.folder",
"driveType": "team"
\}
]
}
List folders (DDL)
Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping
Sample Input Sample Output
{
"folders": [
\{
"id": "1Abc123XyZ",
"name": "Work Projects",
"mimeType": "application/vnd.google-apps.folder"
\},
\{
"id": "2Def456UvW",
"name": "Personal Documents",
"mimeType": "application/vnd.google-apps.folder"
\},
\{
"id": "3Ghi789RsT",
"name": "Shared Files",
"mimeType": "application/vnd.google-apps.folder"
\}
]
}