ユーザーまたはアプリケーションが App Engine Admin API を使用できるようにするには、Google Cloud のプロジェクト オーナーは、プロジェクト内で API を有効にしてから、ユーザーまたはアプリケーションが HTTP リクエストの認証に使用できる認証情報を作成します。
たとえば、Admin API に HTTP リクエストを送信できるようにするには、オーナーが最初に Google Cloudプロジェクトを作成し、そのプロジェクトの認証情報を作成する必要があります。オーナーが初期プロジェクトを設定し構成すると、そのプロジェクトを管理目的に使用して、他のリソースをプログラムによって作成し管理できるようになります。たとえば次のことができます。
他の Google Cloud プロジェクトを作成する。
新しく作成したすべてのプロジェクトで App Engine アプリケーションを作成する。
新しく作成した App Engine アプリケーションにアプリのバージョンをデプロイする。
デプロイしたすべてのバージョンでリソースを管理する。
始める前に
次のタスクを完了するには、アクセスするユーザーとアプリケーション用に Admin API を有効にするGoogle Cloud プロジェクトのオーナーである必要があります。
プロジェクトの構成と認証情報の作成
Google Cloud プロジェクトを構成して認証情報を作成するには:
Google Cloud プロジェクトで App Engine Admin API と Cloud Storage API の両方を有効にします。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eProject owners must enable the App Engine Admin API and Cloud Storage API in their Google Cloud project before users or applications can access it.\u003c/p\u003e\n"],["\u003cp\u003eCredentials must be created within the project to authorize HTTP requests to the Admin API, using OAuth 2.0 scopes like \u003ccode\u003ehttps://www.googleapis.com/auth/appengine.admin\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe initial project setup allows for administrative tasks like creating new Google Cloud projects, deploying app versions, and managing resources within those versions.\u003c/p\u003e\n"],["\u003cp\u003eAn access token, obtained through an OAuth 2.0 flow, is required to make authorized requests to the Admin API, as demonstrated in the provided cURL example for deploying resources.\u003c/p\u003e\n"],["\u003cp\u003eThe implicit grant flow can be utilized to obtain a temporary access token, valid for approximately 60 minutes, enabling client-side applications to access the Admin API on the user's behalf.\u003c/p\u003e\n"]]],[],null,["# Accessing the Admin API\n\nBefore users or applications can use the App Engine Admin API, you as a\nGoogle Cloud project owner must first enable the API in your project and\nthen create credentials that users or applications can use to authorize HTTP\nrequests.\n\nFor example, an owner must first create an initial Google Cloud\nproject and then create credentials in that project before anyone can send HTTP\nrequests to the Admin API. After the owner sets up and configures\nthe initial project, that project can then be used for administrative purposes\nto programmatically create and manage other resources, for example:\n\n- Creating other Google Cloud projects.\n- Creating App Engine applications for all newly created projects.\n- Deploying app versions to newly created App Engine applications.\n- Managing resources in all of the versions that you deployed.\n\nBefore you begin\n----------------\n\nTo complete the following task, you must be an owner of the\nGoogle Cloud project where you want to enable the\nAdmin API for users and applications to access.\n| **Tip:** You can use both the OAuth 2.0 Playground and APIs Explorer to [try out the\n| Admin API](/appengine/docs/admin-api/trying-the-api) before you start configuring your project.\n\nConfiguring your project and creating credentials\n-------------------------------------------------\n\nTo configure your Google Cloud project and create credentials:\n\n1. Enable both the App Engine Admin API and Cloud Storage API in your\n Google Cloud project:\n\n [Enable both APIs](https://console.cloud.google.com/flows/enableapi?apiid=appengine,storage_component)\n2. Create credentials that users and applications use to access the\n Admin API in your project.\n\n To create credentials, review the [Google Cloud Platform Auth\n Guide](/docs/authentication) and then choose the OAuth\n 2.0 authorization flow that meets your app's requirements.\n | **Important:** This API requires that you request access to one of the following OAuth 2.0 scopes in your code:\n | - `https://www.googleapis.com/auth/appengine.admin`\n | - `https://www.googleapis.com/auth/cloud-platform`\n | - `https://www.googleapis.com/auth/cloud-platform.read-only`\n |\n | The **Authorization** section on each method's reference page describes which OAuth scopes are required. Also see the list of methods, permissions, and related roles in [Controlling\n | Access](/appengine/docs/admin-api/access-control#permissions_and_roles) to help you determine which OAuth scope is adequate for your needs.\n\nExamples\n--------\n\nTo demonstrate an authentication flow, the examples below use the client-side\nOAuth 2.0 flow to obtain a token. The token is used to authorize requests to the\nAdmin API using the cURL command-line tool to deploy the example\napp to the App Engine application of the project `[MY_PROJECT_ID]`.\n\n### Authentication example\n\nIn this example, the client-side authorization flow known as the *implicit grant\nflow*, requires the user to authorize the client application for access to the\nAdmin API on behalf of the user. The access token that is returned is\nvalid for approximately 60 minutes or generally while the user is active on your\napplication.\n| **Tip:** For more information about the implicit grant flow and how the URL below is formed, see [using OAuth 2.0 for client-side web\n| applications](https://developers.google.com/identity/protocols/OAuth2UserAgent#formingtheurl).\n\n#### HTTP request\n\nThe following URL uses a client ID that was created in the Google Cloud console to\nrequest an access token and then redirect the user to an authorized URI where\nyour app receives the token: \n\n https://accounts.google.com/o/oauth2/v2/auth?\n response_type=token&\n client_id=[MY_CLIENT_ID].apps.googleusercontent.com&\n scope=https://www.googleapis.com/auth/cloud-platform&\n redirect_uri=[MY_REDIRECT_URI]\n\nWhere:\n\n- `[MY_CLIENT_ID]` is a **Client ID** from one of your credentials in the [Google Cloud console](https://console.cloud.google.com/apis/credentials).\n- `[MY_REDIRECT_URI]` is the corresponding **Authorized redirect URIs** from the same credential in the [Google Cloud console](https://console.cloud.google.com/apis/credentials). If no redirect URI is specified, you must specify a trusted URI, for example `https://www.google.com`. The redirect URI defines where the HTTP response is sent. For production, you must specify your application's auth endpoint, which handles responses from the OAuth 2.0 server. For more information, see [Using\n OAuth 2.0 for Web Server Applications](https://developers.google.com/identity/protocols/OAuth2WebServer#creatingcred).\n\n#### HTTP response\n\nWhen the application uses the URL to request authorization, the access token\nis returned in a response, for example: \n\n https://www.google.com/#access_token=[MY_ACCESS_TOKEN]&\n token_type=Bearer&\n expires_in=3600\n\nWhere `[MY_ACCESS_TOKEN]` is the returned access token that you requested.\n\nAfter you obtain an access token, you can use it to access the\nAdmin API. For example, your application's auth endpoint can\nprogrammatically extract the access token from the response. See the following\nexample for how to manually use your token in a cURL command.\n\n### HTTP request example using cURL\n\nThe following cURL command demonstrates how you can use your `[MY_ACCESS_TOKEN]`\naccess token to make an HTTP `POST` request. This cURL command deploys\nthe resources defined in the `app.json` configuration file to the `v1` version\nof the `default` service in the application of project `MY_PROJECT_ID`. \n\n curl -X POST -T \"app.json\" -H \"Content-Type: application/json\" -H \"Authorization: Bearer [MY_ACCESS_TOKEN]\" https://appengine.googleapis.com/v1/apps/[MY_PROJECT_ID]/services/default/versions\n\nWhat's next\n-----------\n\n- [Deploying Versions To Your\n Application](/appengine/docs/admin-api/deploying-overview)"]]