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.

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

Author: Laurine Ryan

Last Updated:

Views: 5899

Rating: 4.7 / 5 (57 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Laurine Ryan

Birthday: 1994-12-23

Address: Suite 751 871 Lissette Throughway, West Kittie, NH 41603

Phone: +2366831109631

Job: Sales Producer

Hobby: Creative writing, Motor sports, Do it yourself, Skateboarding, Coffee roasting, Calligraphy, Stand-up comedy

Introduction: My name is Laurine Ryan, I am a adorable, fair, graceful, spotless, gorgeous, homely, cooperative person who loves writing and wants to share my knowledge and understanding with you.