Google Workspace API の有効化

Google API を使用する前に、Google Cloud プロジェクトで API を有効にする必要があります。1 つの Google Cloud プロジェクトで 1 つ以上の API を有効にできます。Google Cloud プロジェクトがまだない場合は、Cloud プロジェクトを作成するをご覧ください。

Cloud プロジェクトで API を有効にするには:

Google Cloud コンソール

  1. Google Cloud コンソールで、メニュー > [API とサービス] > [ライブラリ] > [Google Workspace] に移動します。

    [API ライブラリ] に移動

  2. 有効にする API をクリックします。
  3. [有効にする] をクリックします。
  4. さらに API を有効にするには、上記の手順を繰り返します。

Google Cloud CLI

  1. Google Cloud コマンドライン インターフェース(CLI)をインストールするか、開きます。
  2. services enable コマンドを実行して、有効にする API サービスを指定します。

    gcloud services enable API_SERVICE_ID

Google AI Studio で事前有効化されている API

Google AI Studio でウェブアプリを構築する場合、Google Cloud コンソールでサポートされている Google Workspace API を手動で有効にする必要はありません。Google が管理するスターター ティアのプロジェクトでは、次の API が事前に有効になっています。

  • Google カレンダー API(calendar-json.googleapis.com)
  • Google ドキュメント 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 は、デベロッパー API キーではなく OAuth 2.0 アクセス トークンを使用します。サービス アカウントや、Secret Manager への OAuth クライアント シークレットの保存はサポートされていません。サーバーサイドの認証情報、API キー、または Admin SDK API や Google Apps Script API などの追加の API が必要な場合は、Starter ティア プロジェクトを標準の Cloud プロジェクトにアップグレードして、手動で構成できます。

スターター ティアの割り当てと機能の詳細については、スターター ティアの概要と Google AI Studio からウェブアプリをデプロイするをご覧ください。

(省略可)試験運用版アプリで Google Workspace API を試す

Google Workspace を試す場合は、次のショートカットを使用します。これにより、一般的な Google Workspace API が有効になり、使用可能な OAuth 認証情報が作成されます。

ユーザー情報にアクセスするアプリを開発する場合は、アプリをリリースする前に OAuth 同意画面を構成する必要があります。

このボタンをクリックして Google Cloud プロジェクトを選択または作成し、Workspace API を自動的に有効にします。

Workspace API を有効にする

表示されたダイアログで、[クライアント構成をダウンロード] をクリックし、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 を有効にする
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 の認証と認可の仕組みを学習する。