SuperAPI AI 工具集

google-drive

办公与效率

查看项目

更新于 10-16 02:36

技能介绍

用途:通过 Google Drive API v3 管理云端文件,适用于用户提到 Google Drive、drive.google.com、分享 Drive 链接、上传文件或询问云盘相关操作的场景。

主要能力:列出与搜索文件(支持 name、mimeType、modifiedTime、trashed、parents、fullText 等查询运算符及 and/or 组合);获取文件元数据;下载文件内容;将 Google Docs、Sheets、Slides 导出为 PDF、DOCX、XLSX、纯文本或 HTML;上传文件(简单上传限 5MB);更新元数据、复制文件、移入回收站、永久删除;创建文件夹、在父文件夹下建子文件夹、列出文件夹内容;查看、添加、修改、删除共享权限,支持 user、group、domain、anyone 类型与 reader、commenter、writer、owner 角色。

使用方式:Base URL 为 https://www.googleapis.com/drive/v3,请求头携带 Authorization: Bearer $GOOGLE_DRIVE_TOKEN。上传使用 https://www.googleapis.com/upload/drive/v3/files?uploadType=media。简单上传会生成默认名 Untitled,需随后用 PATCH 更新文件名。请求失败时可运行 zero doctor check-connector --env-name GOOGLE_DRIVE_TOKEN 或 zero doctor check-connector --url https://www.googleapis.com/drive/v3/files --method GET 排查。

限制:默认配额为每用户每 100 秒 1000 次请求;简单上传限 5MB,更大文件需用可续传上传;查询中单引号需转义为 ',反斜杠为 \;分页需使用响应中的 pageToken;建议用 fields 参数减少响应体积。文件 ID 永久不变。永久删除不可恢复。

参考:REST 参考 https://developers.google.com/drive/api/v3/reference,搜索指南 https://developers.google.com/drive/api/guides/search-files,上传指南 https://developers.google.com/drive/api/guides/manage-uploads,下载指南 https://developers.google.com/drive/api/guides/manage-downloads,OAuth Playground https://developers.google.com/oauthplayground/,OAuth 范围 https://developers.google.com/identity/protocols/oauth2/scopes#drive。