在使用 Google API 之前,您需要在 Google Cloud 项目中将其开启。 您可以在单个 Google Cloud 项目中启用一个或多个 API。 如果您还没有 Google Cloud 项目,请参阅创建 Cloud 项目。
如需在 Cloud 项目中启用 API,请执行以下操作:
Google Cloud 控制台
- 在 Google Cloud 控制台中,依次前往“菜单”图标 > 更多产品 > Google Workspace > 产品库。
- 点击要启用的 API。
- 点击启用。
- 如需启用更多 API,请重复上述步骤。
Google Cloud CLI
- 安装或打开 Google Cloud 命令行界面 (CLI)。
- 
        运行 services enable命令,指定要启用的 API 服务。gcloud services enable API_SERVICE_ID 
(可选)在实验性应用中试用 Google Workspace API
如果您正在试用 Google Workspace,请使用以下快捷方式,该快捷方式可启用热门的 Google Workspace API,并创建可供您使用的 OAuth 凭据。
如果您正在开发一款会访问用户信息的应用,则必须在发布应用之前配置 OAuth 权限请求页面。
点击此按钮可选择或创建 Google Cloud 项目,并自动启用 Workspace API:
在随即显示的对话框中,点击下载客户端配置,然后将credentials.json 保存到您的工作目录。
如需查看所有可用 API 的完整列表,并尝试通过浏览器使用特定方法,请参阅 Google Workspace API 资源管理器。
已启用的 API(点击可展开)
该按钮可启用以下 API:
- Admin SDK/API
- Apps Script API
- Calendar API
- Chat API
- Classroom API
- Docs API
- Drive API
- Forms API
- Gmail API
- Google Workspace Add-ons API
- Google Keep API
- Meet REST API
- Sheets API
- Slides API
Google Workspace API
使用以下 Google Cloud 控制台链接或 Google Cloud 命令行界面 (CLI) 在您的 Cloud 项目中启用特定的 Google Workspace API。
| Admin SDK API | 启用 Admin SDK API  | 
| Alert Center API | 启用 Alert Center API  | 
| Apps 脚本 API | 启用 Apps Script API  | 
| CalDAV API | 启用 CalDAV API  | 
| Calendar API | 启用 Calendar API  | 
| 聊天 API | 启用 Chat API  | 
| Classroom API | 启用 Classroom API  | 
| Cloud Identity API | 启用 Cloud Identity API  | 
| Cloud Search API | 启用 Cloud Search API  | 
| Docs API | 启用 Docs API  | 
| Drive API | 启用 Drive API  | 
| Drive Activity API | 启用 Drive Activity API  | 
| Drive Labels API | 启用 Drive Labels API  | 
| Forms API | 启用 Forms API  | 
| Gmail API | 启用 Gmail API  | 
| Groups Migration API | 启用 Groups Migration API  | 
| Groups Settings API | 启用 Groups Settings API  | 
| Google Workspace Add-ons API | 启用 Google Workspace Add-ons API  | 
| Google Keep API | 启用 Google Keep API  | 
| Enterprise License Manager API | 启用 Enterprise License Manager API  | 
| Marketplace API | 启用 Marketplace API  | 
| Marketplace SDK | 启用 Marketplace SDK  | 
| Meet REST API | 启用 Meet REST API  | 
| People API | 启用 People API  | 
| Postmaster Tools API | 启用 Postmaster Tools API  | 
| Reseller API | 启用 Reseller API  | 
| Sheets API | 启用 Sheets API  | 
| Slides API | 启用 Slides API  | 
| Tasks API | 启用 Tasks API  | 
| Vault API | 启用 Vault API  |