このページでは、デベロッパーが Google Cloud API の使用を開始する方法について説明します。
Google Cloud API を初めて使用する場合、このガイドの指示に沿って curl コマンドを使用して API を呼び出せます。curl コマンドを使用することで、アプリケーションを開発する前に API を試すことができます。
Google アカウントを作成する
アプリケーションで Google Cloud API を使用するには、まず Google アカウントが必要です。これにより、Google Cloud Console、gcloud CLI、Cloud Logging、Cloud Monitoring、などの Google のデベロッパー プロダクトを使用できるようになります。 Google Cloudを初めて使用する場合は、アカウントを作成して、実際のシナリオで Google プロダクトのパフォーマンスを評価してください。新規のお客様には、ワークロードの実行、テスト、デプロイができる無料クレジット $300 分を差し上げます。
Google プロジェクトの作成
Cloud API を使用するには、Google プロジェクトも必要です。プロジェクトはデベロッパー アカウントに相当します。これは、Google Cloud リソースのリソース コンテナとして機能します。また、 Google Cloud サービスの使用に対して分離境界を提供するため、プロジェクト レベルで割り当て制限と課金を別々に管理できます。使用状況テレメトリーとダッシュボードもプロジェクトごとにグループ化されます。プロジェクトがない場合は、Google Cloud コンソールを使用して作成できます。
プロジェクトでは、API キー、OAuth クライアント、サービス アカウント、Compute Engine VM、Cloud Storage バケット、BigQuery データセットなど、幅広いリソースを所有できます。アプリケーションが Cloud API を呼び出すとき、アプリケーション認証情報を所有するプロジェクトは、クライアント プロジェクトと呼ばれ、ターゲット リソースを所有するプロジェクトはリソース プロジェクトと呼ばれます。1 つの API リクエストが複数のリソースにアクセスする場合、複数のリソース プロジェクトが含まれます。
なんらかの理由で Google Cloud の使用を停止する場合、Google Cloud コンソールを使用してプロジェクトを削除できます。プロジェクトとプロジェクト内のすべてのリソースは、保持期間の後に削除されます。データのタイプごとに保持期間が異なることに留意してください。
API の探索
Cloud APIs を使用する前に、Google Cloud Console の API ライブラリを使用して、使用可能な Cloud APIs を確認し、ビジネスニーズに最適な API を特定する必要があります。特定の Cloud API の詳細については、Spanner API などの一般公開ドキュメント サイトをご覧ください。
API を有効にしています
一部の Cloud API はデフォルトで有効になっています。デフォルトでは有効になっていない Cloud API を使用するには、プロジェクトでそれを有効にする必要があります。どのサービスやプロジェクトにどのプロジェクト(クライアント プロジェクトとリソース プロジェクトなど)が含まれるかに応じて、複数のプロジェクトで API を有効にする必要があります。 他の API に依存する API を有効にすると、依存先の API も同時に有効になります。
API を有効にするには、API の利用規約と請求の責任に同意する必要があります。API を有効にするには、プロジェクトに対する権限 serviceusage.services.enable が必要です。詳細については、Service Usage のアクセス制御をご覧ください。
Cloud API を使用してアプリケーションを構築する場合は、可能であれば Google Cloud クライアント ライブラリを使用することをおすすめします。クライアント ライブラリは、認証、エラー処理、再試行、ペイロード検証などの一般的な API 機能を処理します。初期化中にアプリケーションの認証情報をクライアント ライブラリに渡す必要があります。これにより、クライアント ライブラリでアプリケーションの代わりにGoogle Cloud 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-04-22 UTC。"],[[["\u003cp\u003eThis guide outlines the steps for developers to begin using Google Cloud APIs, starting with experimenting using \u003ccode\u003ecurl\u003c/code\u003e commands.\u003c/p\u003e\n"],["\u003cp\u003eUtilizing Google Cloud APIs necessitates a Google account and a Google project, which serves as a resource container and isolation boundary.\u003c/p\u003e\n"],["\u003cp\u003eBefore using a Cloud API, one must discover it in the API Library and then enable it for the relevant project(s), which may involve accepting terms and billing responsibility.\u003c/p\u003e\n"],["\u003cp\u003eFor using certain APIs and building full applications, a billing account linked to the project and proper authentication credentials, such as Application Default Credentials or API keys, are required.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Cloud Client Libraries are recommended for building applications, as they simplify API interactions by managing authentication, error handling, retries, and payload validation.\u003c/p\u003e\n"]]],[],null,["# Getting started\n\nThis page explains how developers can get started using Google Cloud APIs.\n\nIf you are using Google Cloud APIs for the first time, you can follow\nthe steps in this guide to call the APIs using `curl` commands. You can use\n`curl` commands to experiment with an API before you develop your application.\n\nCreating a Google account\n-------------------------\n\nTo use Google Cloud APIs in your applications, you first need to have a\nGoogle account. This allows you to use Google developer products, including\n[Google Cloud console](https://console.cloud.google.com/),\n[gcloud CLI](/sdk), [Cloud Logging](/logging), and\n[Cloud Monitoring](/monitoring). If you're new to Google Cloud,\n[create an account](https://console.cloud.google.com/freetrial)\nto evaluate how our products perform in real-world scenarios. New customers\nalso get $300 in free credits to run, test, and deploy workloads.\n\nCreating a Google project\n-------------------------\n\nTo use Cloud APIs, you also need to have a Google project. A project is\nequivalent to a developer account. It serves as a resource container for\nyour Google Cloud resources. It also provides an isolation boundary for your\nusage of Google Cloud services, so you can manage quota limits and billing\nindependently at the project level. Usage telemetry and dashboards are grouped\nby projects as well. If you don't already have a project, you can create one\nusing the [Google Cloud console](https://console.cloud.google.com/).\n\nA project can own a wide range of resources, including API keys, OAuth clients,\nservice accounts, Compute Engine VMs, Cloud Storage buckets, and BigQuery\ndatasets. When an\napplication calls a Cloud API, the project that owns the application\ncredentials is called the *client project* , and the project that owns the\ntarget resource is called the *resource project*. One API request may touch\nmultiple resources, hence multiple resource projects are involved.\n\nIf you want to stop using Google Cloud for any reasons, you can use\n[Google Cloud console](https://console.cloud.google.com/) to delete your project. Your\nproject and all resources in the project will be deleted after the retention\nwindow. Note that different types of data have different retention periods.\n\nDiscovering APIs\n----------------\n\nBefore using any Cloud APIs, you should use Google Cloud console\n[API Library](https://console.cloud.google.com/apis/library/browse) to\nbrowse available Cloud APIs and discover the ones that best meet your business\nneeds. For more information about a specific Cloud API, visit its public\ndocumentation site, such as [Spanner API](/spanner).\n\nEnabling APIs\n-------------\n\nSome Cloud APIs are enabled by default. To use a Cloud API that is not enabled\nby default, you must enable it for your project. Depending on which\nservices and which projects are involved from your application, including the\nclient project and resource projects, you may need to enable an API for\nmultiple projects. When you enable an API that depends on other APIs, those APIs\nare also enabled at the same time.\n\nEnabling an API requires you to accept the Terms of Service and billing\nresponsibility for the API. You need permission `serviceusage.services.enable`\non the project to enable APIs. For more information, see Service Usage\n[Access Control](/service-usage/docs/access-control).\n\nIn addition, the service to enable must either be public, or else the service\nowner must grant the user the `servicemanagement.services.bind` permission on\nthe private service. See [Service Management Access Control](/service-infrastructure/docs/service-management/access-control) for more\ninformation.\n\nTo enable an API for a project using the console:\n\n1. Go to the [Google Cloud console API Library](https://console.cloud.google.com/apis/library?project=_).\n2. From the projects list, select the project you want to use.\n3. In the API Library, select the API you want to enable. If you need help finding the API, use the search field and/or the filters.\n4. On the API page, click **ENABLE**.\n\nFrom the same page you can disable an API for your project if you no longer\nuse it to avoid misuse and accidental billing charges. You can also enable\nand disable Cloud APIs using the [gcloud CLI](/sdk/docs) and the\n[Service Usage API](/service-usage/docs/reference/rest/v1/services/enable): \n\n $ gcloud services enable pubsub.googleapis.com\n $ gcloud services disable pubsub.googleapis.com\n\nEnabling billing\n----------------\n\nSome Cloud APIs charge for usage. You need to enable billing for your project\nbefore you can start using these APIs in your project. The API usage in a\nproject is charged to the billing account associated with the project.\n\nIf you don't have a billing account, go to the\n[Google Cloud console billing page](https://console.cloud.google.com/billing)\nand follow the instructions to create one. Then\n[link your billing account](https://console.cloud.google.com/billing/linkedaccount?project=_)\nto your project.\n\nAuthenticating to APIs\n----------------------\n\nHow you authenticate to an API depends on your development environment and what\nauthentication methods the API supports.\n\nSetting up [Application Default Credentials](/docs/authentication/provide-credentials-adc) for use in a variety of\nenvironments is the most common approach, and is recommended for most\napplications. If the API supports [API keys](/docs/authentication/api-keys), that is another option.\nIf your application needs to access Cloud resources owned by your end users, you\n[create an OAuth 2.0 Client ID and use the authentication libraries](https://developers.google.com/identity/protocols/oauth2/web-server).\n\nFor general information about authentication, see\n[Authentication at Google](/docs/authentication).\n\nBuilding applications\n---------------------\n\nIf you are building an application using Cloud APIs, we recommend you to use\n[Google Cloud Client Libraries](/apis/docs/cloud-client-libraries) if\navailable. The client libraries can handle common API features for your\nconvenience, such as authentication, error handling, retry, and payload\nvalidation. You need to pass your application credentials to the client\nlibraries during initialization, so the client libraries can make calls to\nGoogle Cloud APIs on behalf of your application.\n\nSee the following step-by-step guides that use the client libraries for some\npopular APIs:\n\n- [Cloud Billing Budget API with Node.js](https://console.cloud.google.com/?tutorial=billing--budget--billing-budget-api-nodejs).\n- [Cloud Billing Budget API with Python](https://console.cloud.google.com/?tutorial=billing--budget--billing-budget-api-python).\n- [Cloud Logging with Node.js](https://console.cloud.google.com/?tutorial=logging--logging-nodejs).\n- [Cloud Logging with Python](https://console.cloud.google.com/?tutorial=logging--logging-python).\n- [Cloud Logging with Go](https://console.cloud.google.com/?tutorial=logging--logging-go).\n- [Cloud Logging with Java](https://console.cloud.google.com/?tutorial=logging--logging-java).\n- [Speech-to-Text with Node.js](https://console.cloud.google.com/?tutorial=speech-to-text--speech-to-text-nodejs).\n- [Speech-to-Text with Python](https://console.cloud.google.com/?tutorial=speech-to-text--speech-to-text-python).\n- [Speech-to-Text with Go](https://console.cloud.google.com/?tutorial=speech-to-text--speech-to-text-go).\n- [Speech-to-Text with Java](https://console.cloud.google.com/?tutorial=speech-to-text__speech-to-text-java).\n\nFor more information, see\n[Client Libraries Explained](/apis/docs/client-libraries-explained).\n\nMore information\n----------------\n\n- For more information about authentication, see\n [Authentication at Google](/docs/authentication).\n\n- For more information about error handling, see\n [Handling Errors](/apis/design/errors#handling_errors).\n\n- For more information about billing, see\n [Create, modify, or close your billing account](/billing/docs/how-to/manage-billing-account).\n\n- For more information about enabling billing on your project, see\n [Modify a project's billing settings](/billing/docs/how-to/modify-project).\n\n- For more information about enabling and disabling APIs, see\n [Enabling and disabling services](/service-usage/docs/enable-disable)."]]