启用 Google Workspace API

在使用 Google API 之前,您需要在 Google Cloud 项目中将其开启。 您可以在单个 Google Cloud 项目中启用一个或多个 API。 如果您还没有 Google Cloud 项目,请参阅创建 Cloud 项目

如需在 Cloud 项目中启用 API,请执行以下操作:

Google Cloud 控制台

  1. 在 Google Cloud 控制台中,依次前往“菜单”图标 > 更多产品 > Google Workspace > 产品库

    前往“商品库”

  2. 点击要启用的 API。
  3. 点击启用
  4. 如需启用更多 API,请重复上述步骤。

Google Cloud CLI

  1. 安装或打开 Google Cloud 命令行界面 (CLI)
  2. 运行 services enable 命令,指定要启用的 API 服务。

    gcloud services enable API_SERVICE_ID

(可选)在实验性应用中试用 Google Workspace API

如果您正在试用 Google Workspace,请使用以下快捷方式,该快捷方式可启用热门的 Google Workspace API,并创建可供您使用的 OAuth 凭据。

如果您正在开发一款会访问用户信息的应用,则必须在发布应用之前配置 OAuth 权限请求页面

点击此按钮可选择或创建 Google Cloud 项目,并自动启用 Workspace API:

启用 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
gcloud services enable admin.googleapis.com
启用 Alert Center API
gcloud services enable alertcenter.googleapis.com
启用 Apps Script API
gcloud services enable script.googleapis.com
启用 CalDAV API
gcloud services enable caldav.googleapis.com
启用 Calendar API
gcloud services enable calendar-json.googleapis.com
启用 Chat API
gcloud services enable chat.googleapis.com
启用 Classroom API
gcloud services enable classroom.googleapis.com
启用 Cloud Identity API
gcloud services enable cloudidentity.googleapis.com
启用 Cloud Search API
gcloud services enable cloudsearch.googleapis.com
启用 Docs API
gcloud services enable docs.googleapis.com
启用 Drive API
gcloud services enable drive.googleapis.com
启用 Drive Activity API
gcloud services enable driveactivity.googleapis.com
启用 Drive Labels API
gcloud services enable drivelabels.googleapis.com
启用 Forms API
gcloud services enable forms.googleapis.com
启用 Gmail API
gcloud services enable gmail.googleapis.com
启用 Groups Migration API
gcloud services enable groupsmigration.googleapis.com
启用 Groups Settings API
gcloud services enable groupssettings.googleapis.com
启用 Google Workspace Add-ons API
gcloud services enable gsuiteaddons.googleapis.com
启用 Google Keep API
gcloud services enable keep.googleapis.com
启用 Enterprise License Manager API
gcloud services enable licensing.googleapis.com
启用 Marketplace API
gcloud services enable appsmarket.googleapis.com
启用 Marketplace SDK
gcloud services enable appsmarket-component.googleapis.com
启用 Meet REST API
gcloud services enable meet.googleapis.com
启用 People API
gcloud services enable people.googleapis.com
启用 Postmaster Tools API
gcloud services enable gmailpostmastertools.googleapis.com
启用 Reseller API
gcloud services enable reseller.googleapis.com
启用 Sheets API
gcloud services enable sheets.googleapis.com
启用 Slides API
gcloud services enable slides.googleapis.com
启用 Tasks API
gcloud services enable tasks.googleapis.com
启用 Vault API
gcloud services enable vault.googleapis.com

下一步

了解 Google Workspace API 的身份验证和授权机制