39 lines
1.1 KiB
Markdown
39 lines
1.1 KiB
Markdown
---
|
||
title: "Drive API"
|
||
type: concept
|
||
tags: [google-workspace, api, cloud-storage]
|
||
---
|
||
|
||
## Definition
|
||
Drive API 是 Google 提供的编程接口,允许第三方应用程序通过 OAuth 2.0 认证访问 Google Drive 云端硬盘服务,实现文件搜索、下载、上传和管理等功能。
|
||
|
||
## Key Operations
|
||
| 操作 | 描述 |
|
||
|------|------|
|
||
| files.list | 列出文件 |
|
||
| files.get | 获取文件元数据 |
|
||
| files.create | 上传文件 |
|
||
| files.update | 更新文件 |
|
||
| files.delete | 删除文件 |
|
||
| drive.search | 搜索文件 |
|
||
|
||
## Prerequisites for Access
|
||
1. **Google Cloud Console** 中启用 Drive API
|
||
2. 配置 **OAuth 2.0 凭证**(桌面应用类型)
|
||
3. 用户完成 OAuth 授权流程
|
||
4. 添加**测试用户**(未验证应用场景)
|
||
|
||
## Common Error
|
||
- `403 accessNotConfigured`:API 未启用
|
||
- `403 accessDenied`:OAuth 未授权
|
||
|
||
## Related Concepts
|
||
- [[OAuth]]:认证机制
|
||
- [[Google-Cloud-Console]]:凭证配置
|
||
- [[测试用户]]:绕过未验证应用限制
|
||
- [[API-Enablement]]:启用 API 的操作
|
||
|
||
## Related Entities
|
||
- [[Google]]:API 提供方
|
||
- [[gog CLI]]:使用 Drive API 的命令行工具
|