Overview
A client-mode connector for a curated slice of Google Drive API v3 underhttps://www.googleapis.com:
Default
BASE_ADDRESS is https://www.googleapis.com (no trailing slash). Metadata endpoints start with /drive/v3/; media uploads use /upload/drive/v3/. Topics use storage/google-drive/<object>/<verb>.
See the base guide: REST API Connectors.
Search queries: put the Drive query in
{value.json.q} already URL-encoded. Example: name contains 'line-a' and trashed=false → name%20contains%20%27line-a%27%20and%20trashed%3Dfalse. Send "q": "" to list everything visible to the token.Shared drives: every event sends
supportsAllDrives=true and the list event also sends includeItemsFromAllDrives=true, so files in shared drives work without extra flags.Prefer Hub secrets for access tokens (
GET SECRET "GOOGLE_DRIVE_TOKEN" or "GOOGLE_ACCESS_TOKEN"). Scope: https://www.googleapis.com/auth/drive.file (least privilege, files the app created or opened) or https://www.googleapis.com/auth/drive (full). This template has not been verified against a live Google Cloud project. Status remains blocked until an authenticated live smoke succeeds.Basic Syntax
Auth
- Enable Google Drive API on a Google Cloud project.
- Obtain an OAuth 2.0 user access token or a service-account access token. A service account has its own Drive: share the target folder (or shared drive) with the service-account email, or use domain-wide delegation in Google Workspace.
- Scope:
https://www.googleapis.com/auth/drive.filecovers files the connector creates. Usehttps://www.googleapis.com/auth/driveto read or update files created elsewhere. Use.../drive.metadata.readonlyonly if you stick to GET events. - Pass
api_tokenon each MQTT payload →Authorization: Bearer {value.json.api_token}. Prefer Hub secrets /GET SECRET "GOOGLE_DRIVE_TOKEN"or"GOOGLE_ACCESS_TOKEN". Never commit real tokens.
MQTT topics
Example payloads
Credential smoke (GetAbout):
ListFiles):
Body fields:
CreateFile, UpdateFile, and UploadFileMedia send {payload} as the body. Google APIs can reject unknown JSON fields (such as api_token or fileId) with HTTP 400. If your broker forwards the whole payload, publish only Drive file fields and inject the Bearer from a Hub secret or connector wiring.CreateFile):
UpdateFile):
DeleteFile):
DeleteFile → HTTP 204):
Uploads (advanced)
UploadFileMedia uses uploadType=media: the whole MQTT payload becomes the file content (application/json, up to 5 MB). Drive names the file Untitled with no parent, so follow with UpdateFile using the returned id to set name and move it with addParents.
uploadType=multipart (metadata and content in one multipart/related request) and uploadType=resumable (large files) are not templated. They need a multipart body or a two-step session that a single MQTT JSON payload does not map to cleanly.
Push notifications
Drive can push change notifications (files.watch, changes.watch) to an HTTPS webhook. That is a server-mode companion (ENABLE_SERVER) and is not part of this client template.
Quotas and limits
Google Drive API enforces per-project and per-user quotas. Bursts from many devices can return HTTP 403userRateLimitExceeded or 429. Batch snapshots at the edge and back off on errors.
Deploy notes
- Deploy only
GoogleDriveRestApi.lotwith-addRoute/ Hub deploy. Do not deployhub-metadata.lot. - Hub listing uses
hub-metadata.lot(WITH IMAGE,WITH STATUS "beta", doclink). - Suggested branches (Hugo pushes):
feat/rest-api-route-google-drive,feat/docs-rest-api-google-drive.
Related
- REST API Connectors
- REST API Apps catalog
- Google Sheets
- Google Cloud Storage
- Google Drive API reference
- Discovery:
https://www.googleapis.com/discovery/v1/apis/drive/v3/rest

