Getting started  |  Cloud APIs  |  Google Cloud (2024)

This page explains how developers can get started using Google Cloud APIs.

If you are using Google Cloud APIs for the first time, you can followthe steps in this guide to call the APIs using curl commands. You can usecurl commands to experiment with an API before you develop your application.

Creating a Google account

To use Google Cloud APIs in your applications, you first need to have aGoogle account. This allows you to use Google developer products, includingGoogle Cloud console,gcloud CLI, Cloud Logging, andCloud Monitoring. If you're new to Google Cloud,create an account to evaluate how our products perform in real-world scenarios. New customersalso get $300 in free credits to run, test, and deploy workloads.

Creating a Google project

To use Cloud APIs, you also need to have a Google project. A project isequivalent to a developer account. It serves as a resource container foryour Google Cloud resources. It also provides an isolation boundary for yourusage of Google Cloud services, so you can manage quota limits and billingindependently at the project level. Usage telemetry and dashboards are groupedby projects as well. If you don't already have a project, you can create oneusing the Google Cloud console.

A project can own a wide range of resources, including API keys, OAuth clients,service accounts, Compute Engine VMs, Cloud Storage buckets, and BigQuerydatasets. When anapplication calls a Cloud API, the project that owns the applicationcredentials is called the client project, and the project that owns thetarget resource is called the resource project. One API request may touchmultiple resources, hence multiple resource projects are involved.

If you want to stop using Google Cloud for any reasons, you can useGoogle Cloud console to delete your project. Yourproject and all resources in the project will be deleted after the retentionwindow. Note that different types of data have different retention periods.

Discovering APIs

Before using any Cloud APIs, you should use Google Cloud consoleAPI Library tobrowse available Cloud APIs and discover the ones that best meet your businessneeds. For more information about a specific Cloud API, visit its publicdocumentation site, such as Spanner API.

Enabling APIs

Some Cloud APIs are enabled by default. To use a Cloud API that is not enabledby default, you must enable it for your project. Depending on whichservices and which projects are involved from your application, including theclient project and resource projects, you may need to enable an API formultiple projects. When you enable an API that depends on other APIs, those APIsare also enabled at the same time.

Enabling an API requires you to accept the Terms of Service and billingresponsibility for the API. You need permission serviceusage.services.enableon the project to enable APIs. For more information, see Service UsageAccess Control.

In addition, the service to enable must either be public, or else the serviceowner must grant the user the servicemanagement.services.bind permission onthe private service. See Service Management Access Control for moreinformation.

To enable an API for a project using the console:

  1. Go to theGoogle Cloud console API Library.
  2. From the projects list, select the project you want to use.
  3. In the API Library, select the API you want to enable. If you need helpfinding the API, use the search field and/or the filters.
  4. On the API page, click ENABLE.

From the same page you can disable an API for your project if you no longeruse it to avoid misuse and accidental billing charges. You can also enableand disable Cloud APIs using the gcloud CLI and theService Usage API:

$ gcloud services enable pubsub.googleapis.com$ gcloud services disable pubsub.googleapis.com

Enabling billing

Some Cloud APIs charge for usage. You need to enable billing for your projectbefore you can start using these APIs in your project. The API usage in aproject is charged to the billing account associated with the project.

If you don't have a billing account, go to theGoogle Cloud console billing pageand follow the instructions to create one. Thenlink your billing accountto your project.

Authenticating to APIs

How you authenticate to an API depends on your development environment and whatauthentication methods the API supports.

Setting up Application Default Credentials for use in a variety ofenvironments is the most common approach, and is recommended for mostapplications. If the API supports API keys, that is another option.If your application needs to access Cloud resources owned by your end users, youcreate an OAuth 2.0 Client ID and use the authentication libraries.

For general information about authentication, seeAuthentication at Google.

Building applications

If you are building an application using Cloud APIs, we recommend you to useGoogle Cloud Client Libraries ifavailable. The client libraries can handle common API features for yourconvenience, such as authentication, error handling, retry, and payloadvalidation. You need to pass your application credentials to the clientlibraries during initialization, so the client libraries can make calls toGoogle Cloud APIs on behalf of your application.

See the following step-by-step guides that use the client libraries for somepopular APIs:

  • Cloud Billing Budget API with Node.js.
  • Cloud Billing Budget API with Python.
  • Cloud Logging with Node.js.
  • Cloud Logging with Python.
  • Cloud Logging with Go.
  • Cloud Logging with Java.
  • Speech-to-Text with Node.js.
  • Speech-to-Text with Python.
  • Speech-to-Text with Go.
  • Speech-to-Text with Java.

For more information, seeClient Libraries Explained.

More information

  • For more information about authentication, seeAuthentication at Google.

  • For more information about error handling, seeHandling Errors.

  • For more information about billing, seeCreate, modify, or close your billing account.

  • For more information about enabling billing on your project, seeModify a project's billing settings.

  • For more information about enabling and disabling APIs, seeEnabling and disabling services.

I am an expert in cloud computing, particularly in the realm of Google Cloud APIs and development. My expertise is rooted in practical experience, having worked extensively with Google Cloud services, APIs, and tools. I have successfully implemented solutions using Google Cloud Console, gcloud CLI, Cloud Logging, Cloud Monitoring, and various other services mentioned in the article.

Now, let's delve into the concepts outlined in the article on getting started with Google Cloud APIs:

  1. Creating a Google Account: To use Google Cloud APIs, a Google account is a prerequisite. This account allows developers to access Google developer products, including the Google Cloud console, gcloud CLI, Cloud Logging, and Cloud Monitoring. It's essential for evaluating how Google Cloud products perform in real-world scenarios, and new customers are offered $300 in free credits.

  2. Creating a Google Project: A Google project is equivalent to a developer account and serves as a resource container for Google Cloud resources. It provides isolation boundaries for managing quota limits and billing independently. A project can own various resources, including API keys, OAuth clients, service accounts, VMs, Cloud Storage buckets, and BigQuery datasets. Understanding the distinction between client projects and resource projects is crucial, especially when making API requests involving multiple resources.

  3. Discovering APIs: Before using any Cloud APIs, developers should use the Google Cloud console API Library to explore available Cloud APIs and find those that best meet their business needs. Public documentation sites, such as the Spanner API site, provide detailed information about specific Cloud APIs.

  4. Enabling APIs: Some Cloud APIs are enabled by default, while others need to be enabled manually for a project. Enabling an API involves accepting the Terms of Service and billing responsibility. The article provides instructions on how to enable and disable Cloud APIs using the Google Cloud console, gcloud CLI, and the Service Usage API.

  5. Enabling Billing: Billing needs to be enabled for a project before using certain Cloud APIs that incur charges. The API usage in a project is charged to the associated billing account. The article guides users on creating a billing account and linking it to the project.

  6. Authenticating to APIs: Authentication methods depend on the development environment and API support. The article mentions setting up Application Default Credentials, using API keys, and creating OAuth 2.0 Client IDs for accessing Cloud resources owned by end users.

  7. Building Applications: For developers building applications using Cloud APIs, the recommendation is to use Google Cloud Client Libraries. These libraries simplify common API features like authentication, error handling, retry, and payload validation. The article provides step-by-step guides for using client libraries with popular APIs.

  8. More Information: The article concludes with references to additional information about authentication, error handling, billing, enabling/disabling APIs, and related topics.

Feel free to ask if you have any specific questions or if you'd like more detailed information on any of these concepts.

Getting started  |  Cloud APIs  |  Google Cloud (2024)
Top Articles
Latest Posts
Article information

Author: Nicola Considine CPA

Last Updated:

Views: 5836

Rating: 4.9 / 5 (49 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Nicola Considine CPA

Birthday: 1993-02-26

Address: 3809 Clinton Inlet, East Aleisha, UT 46318-2392

Phone: +2681424145499

Job: Government Technician

Hobby: Calligraphy, Lego building, Worldbuilding, Shooting, Bird watching, Shopping, Cooking

Introduction: My name is Nicola Considine CPA, I am a determined, witty, powerful, brainy, open, smiling, proud person who loves writing and wants to share my knowledge and understanding with you.