5.1 KiB
5.1 KiB
Google Drive Routing Reference
App name: google-drive
Base URL proxied: www.googleapis.com
API Path Pattern
/google-drive/drive/v3/{endpoint}
Common Endpoints
List Files
GET /google-drive/drive/v3/files?pageSize=10
With query:
GET /google-drive/drive/v3/files?q=name%20contains%20'report'&pageSize=10
Only folders:
GET /google-drive/drive/v3/files?q=mimeType='application/vnd.google-apps.folder'
Files in specific folder:
GET /google-drive/drive/v3/files?q='FOLDER_ID'+in+parents
With fields:
GET /google-drive/drive/v3/files?fields=files(id,name,mimeType,createdTime,modifiedTime,size)
Get File Metadata
GET /google-drive/drive/v3/files/{fileId}?fields=id,name,mimeType,size,createdTime
Download File Content
GET /google-drive/drive/v3/files/{fileId}?alt=media
Export Google Docs (to PDF, DOCX, etc.)
GET /google-drive/drive/v3/files/{fileId}/export?mimeType=application/pdf
Create File (metadata only)
POST /google-drive/drive/v3/files
Content-Type: application/json
{
"name": "New Document",
"mimeType": "application/vnd.google-apps.document"
}
Create Folder
POST /google-drive/drive/v3/files
Content-Type: application/json
{
"name": "New Folder",
"mimeType": "application/vnd.google-apps.folder"
}
Update File Metadata
PATCH /google-drive/drive/v3/files/{fileId}
Content-Type: application/json
{
"name": "Renamed File"
}
Move File to Folder
PATCH /google-drive/drive/v3/files/{fileId}?addParents=NEW_FOLDER_ID&removeParents=OLD_FOLDER_ID
Delete File
DELETE /google-drive/drive/v3/files/{fileId}
Copy File
POST /google-drive/drive/v3/files/{fileId}/copy
Content-Type: application/json
{
"name": "Copy of File"
}
Create Permission (Share File)
POST /google-drive/drive/v3/files/{fileId}/permissions
Content-Type: application/json
{
"role": "reader",
"type": "user",
"emailAddress": "user@example.com"
}
File Uploads
Upload endpoints use a different path pattern: /google-drive/upload/drive/v3/files
Simple Upload (up to 5MB)
POST /google-drive/upload/drive/v3/files?uploadType=media
Content-Type: text/plain
<file content>
Multipart Upload (with metadata, up to 5MB)
POST /google-drive/upload/drive/v3/files?uploadType=multipart
Content-Type: multipart/related; boundary=boundary
--boundary
Content-Type: application/json
{"name": "myfile.txt"}
--boundary
Content-Type: text/plain
<file content>
--boundary--
Resumable Upload (for large files)
# Step 1: Initiate session
POST /google-drive/upload/drive/v3/files?uploadType=resumable
Content-Type: application/json
X-Upload-Content-Type: application/octet-stream
X-Upload-Content-Length: <file_size>
{"name": "large_file.bin"}
# Response includes Location header with upload URI
# Step 2: Upload content to that URI
Update File Content
PATCH /google-drive/upload/drive/v3/files/{fileId}?uploadType=media
Content-Type: text/plain
<new file content>
Query Operators
Use in the q parameter:
name = 'exact name'name contains 'partial'mimeType = 'application/pdf''folderId' in parentstrashed = falsemodifiedTime > '2024-01-01T00:00:00'
Combine with and:
name contains 'report' and mimeType = 'application/pdf'
Common MIME Types
application/vnd.google-apps.document- Google Docsapplication/vnd.google-apps.spreadsheet- Google Sheetsapplication/vnd.google-apps.presentation- Google Slidesapplication/vnd.google-apps.folder- Folderapplication/pdf- PDF
Notes
- Authentication is automatic - the router injects the OAuth token
- Use
fieldsparameter to limit response data - Pagination uses
pageTokenfrom previous response'snextPageToken - Upload endpoints use
/upload/drive/v3/filespath (note the/uploadprefix) - Use
uploadType=resumablefor files larger than 5MB - Resumable uploads support chunking (256KB minimum, 5MB recommended)