Włącz interfejsy API Google Workspace

Zanim zaczniesz korzystać z interfejsów API Google, musisz je włączyć w projekcie w chmurze Google. W jednym projekcie Google Cloud możesz włączyć 1 lub więcej interfejsów API. Jeśli nie masz jeszcze projektu Google Cloud, zapoznaj się z artykułem Tworzenie projektu Google Cloud.

Aby włączyć interfejs API w projekcie w chmurze:

Konsola Google Cloud

  1. W konsoli Google Cloud otwórz Menu  > Interfejsy API i usługi > Biblioteka > Google Workspace.

    Otwórz bibliotekę interfejsów API

  2. Kliknij interfejs API, który chcesz włączyć.
  3. Kliknij Włącz.
  4. Aby włączyć więcej interfejsów API, powtórz te czynności.

Google Cloud CLI

  1. Zainstaluj lub otwórz interfejs wiersza poleceń Google Cloud (CLI).
  2. Uruchom polecenie services enable, określając, którą usługę interfejsu API chcesz włączyć.

    gcloud services enable API_SERVICE_ID

Wstępnie włączone interfejsy API w Google AI Studio

Gdy tworzysz aplikacje internetowe w Google AI Studio, nie musisz ręcznie włączać obsługiwanych interfejsów API Google Workspace w konsoli Google Cloud. W projekcie na poziomie Starter zarządzanym przez Google wstępnie włączone są te interfejsy 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)

W projekcie na poziomie Starter interfejsy Google Workspace API obsługują tylko protokół OAuth 2.0 po stronie klienta. Na przykład interfejs Google Picker API używa tokenów dostępu OAuth 2.0 zamiast klucza interfejsu API dewelopera, a konta usługi i przechowywanie tajnych kluczy klienta OAuth w usłudze Secret Manager nie są obsługiwane. Jeśli potrzebujesz danych logowania po stronie serwera, kluczy interfejsu API lub dodatkowych interfejsów API, takich jak interfejs API pakietu Admin SDK lub interfejs API Google Apps Script, możesz uaktualnić projekt na poziomie startowym do standardowego projektu w chmurze i skonfigurować je ręcznie.

Szczegółowe informacje o limitach i funkcjach poziomu startowego znajdziesz w artykułach Omówienie poziomu startowego i Wdrażanie aplikacji internetowych z Google AI Studio.

(Opcjonalnie) Wypróbuj interfejsy Google Workspace API w aplikacjach eksperymentalnych

Jeśli eksperymentujesz z Google Workspace, użyj poniższego skrótu, który włącza popularne interfejsy API Google Workspace i tworzy dane logowania OAuth, których możesz używać.

Jeśli tworzysz aplikację, która uzyskuje dostęp do informacji o użytkownikach, przed jej opublikowaniem musisz skonfigurować ekran zgody OAuth.

Kliknij ten przycisk, aby wybrać lub utworzyć projekt Google Cloud i automatycznie włączyć interfejsy Workspace API:

Włączanie interfejsów API Workspace

W wyświetlonym oknie kliknij Pobierz konfigurację klienta i zapisz plik credentials.json w katalogu roboczym.

Zobacz APIs Explorer interfejsów Google Workspace API, aby uzyskać pełną listę wszystkich dostępnych interfejsów API i wypróbować konkretne metody w przeglądarce.

Włączone interfejsy API (kliknij, aby rozwinąć)

Przycisk włącza te interfejsy 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

Interfejsy Google Workspace API

Aby włączyć określone interfejsy Google Workspace API w projekcie w chmurze, użyj poniższych linków do konsoli Google Cloud lub interfejsu wiersza poleceń (CLI) Google Cloud.

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

Następny krok

Dowiedz się, jak działa uwierzytelnianie i autoryzacja w przypadku interfejsów Google Workspace API.