您必須先在 Google Cloud 專案中啟用 Google API,才能使用。您可以在單一 Google Cloud 專案中啟用一或多個 API。 如果您尚未建立 Google Cloud 專案,請參閱「建立 Cloud 專案」。
如要在 Cloud 專案中啟用 API,請按照下列步驟操作:
Google Cloud 控制台
- 在 Google Cloud 控制台中,依序前往「Menu」(選單) >「APIs & Services」(API 和服務) >「Library」(程式庫) >「Google Workspace」。
- 按一下要啟用的 API。
- 按一下「啟用」。
- 如要啟用更多 API,請重複執行這些步驟。
Google Cloud CLI
- 安裝或開啟 Google Cloud 指令列介面 (CLI)。
-
執行
services enable指令,指定要啟用的 API 服務。gcloud services enable API_SERVICE_ID
Google AI Studio 中預先啟用的 API
在 Google AI Studio 建構網頁應用程式時,您不需要在 Google Cloud 控制台手動啟用支援的 Google Workspace API。Google 代管的入門級專案已預先啟用下列 API:
- Google Calendar API (
calendar-json.googleapis.com) - Google Docs API (
docs.googleapis.com) - Google Drive API (
drive.googleapis.com) - Google Forms API (
forms.googleapis.com) - Gmail API (
gmail.googleapis.com) - Google Picker API (
picker.googleapis.com) - Google Sheets API (
sheets.googleapis.com) - Google Slides API (
slides.googleapis.com) - Google Tasks API (
tasks.googleapis.com)
在入門級專案中,Google Workspace API 僅支援用戶端 OAuth 2.0。舉例來說,Google Picker API 使用 OAuth 2.0 存取權杖,而非開發人員 API 金鑰,且不支援服務帳戶或將 OAuth 用戶端密鑰儲存在 Secret Manager。如需伺服器端憑證、API 金鑰或其他 API (例如 Admin SDK API 或 Google Apps Script API),可以將 Starter 級專案升級為標準 Cloud 專案,並手動設定。
如要進一步瞭解入門級配額和功能,請參閱「入門級總覽」和「透過 Google AI Studio 部署網頁應用程式」。
(選用) 在實驗性應用程式中試用 Google Workspace API
如果您正在試用 Google Workspace,請使用下列捷徑,啟用熱門的 Google Workspace API,並建立可用的 OAuth 憑證。
如果您開發的應用程式會存取使用者資訊,請務必先設定 OAuth 同意畫面,再發布應用程式。
按一下這個按鈕,選取或建立 Google Cloud 雲端專案,並自動啟用 Workspace API:
在產生的對話方塊中,按一下「Download client configuration」(下載用戶端設定),然後將credentials.json 儲存至目前使用的目錄。如需所有可用 API 的完整清單,並在瀏覽器中試用特定方法,請參閱 Google Workspace APIs Explorer。
已啟用的 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),在雲端專案中啟用特定 Google Workspace API。
Admin SDK API |
啟用 Admin SDK API
|
Alert Center API |
啟用 Alert Center API
|
Apps Script API |
啟用 Apps Script API
|
CalDAV API |
啟用 CalDAV API
|
Calendar API |
啟用 Calendar API
|
Chat 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
|