Client Libraries Explained

While you can use Google Cloud APIs by making direct HTTP requests to the server (or RPC calls where available), we provide client library code for all our Cloud APIs that makes it easier to access them from your favorite languages. This document explains the different types of client libraries we provide for Cloud APIs. You can find out more about the available libraries for your product or language of choice in the product or language’s documentation.

Google Cloud Client Libraries

Google Cloud Client Libraries use our latest client library model and are our recommended option for accessing Cloud APIs programmatically, where available. Cloud Client Libraries:

  • Provide idiomatic, generated or hand-written code in each language, making the Cloud API simple and intuitive to use.
  • Handle all the low-level details of communication with the server, including authenticating with Google.
  • Can be installed using familiar package management tools such as npm and pip.
  • For some libraries, give you performance benefits from gRPC. You can find out more in the gRPC APIs section below.

You can find installation instructions and reference material for the appropriate Cloud Client Library on your chosen Cloud API’s Client Libraries page.

For almost all our supported languages, you can also download a single client library that provides an interface to all supported Cloud APIs. You can find links to get started with these and their reference documentation on our Cloud Client Libraries page.

Google API Client Libraries

A number of Google Cloud APIs do not yet have Google Cloud Client Libraries available in all languages. If you want to use one of these APIs and there is no Cloud Client Library for your preferred language, you can still use an older version of our client libraries called Google API Client Libraries. These libraries:

  • Provide access to the API’s REST interface only, gRPC is not supported.
  • Have autogenerated interface code that may not be as idiomatic as our newer libraries.
  • Handle all the low-level details of communication with the server, including authenticating with Google.
  • Can be installed using familiar package management tools such as npm and pip.

You'll find links to these libraries on the relevant Cloud API's Client Libraries page, where necessary.

Using the Firebase mobile platform

Firebase is the Google-wide solution for building applications on mobile devices. It offers an SDK with client code that lets you access mobile-relevant Cloud APIs directly from iOS, Android, and Web apps. Visit the Firebase documentation for more information on which Cloud APIs are supported and how to get started with Firebase.

Using your own client code

Generally we recommend using our client libraries to access Cloud APIs. However, if you are an experienced developer and our client libraries don't meet your specific needs, you can write your own custom code to access the service's lower-level service APIs directly.

REST/HTTP APIs

All Cloud APIs expose a simple traditional JSON/REST interface. If you need to write your own custom code to directly access the REST API using a third-party HTTP client library of your choice, you can find out more about how Cloud APIs work with different HTTP versions and implementations in our HTTP Guidelines.

gRPC APIs

gRPC is a language-neutral, platform-neutral, open source, remote procedure call (RPC) system initially developed at Google: you can find out much more about it at grpc.io. gRPC-enabled Cloud APIs generally have both REST and RPC interfaces, so rather than just using JSON over HTTP to talk to the REST interface, gRPC-enabled API clients can also use protocol buffers and gRPC over HTTP2 to talk to the RPC interface. You can find out if an API is gRPC-enabled by checking its APIs and Reference section.

If a Cloud API is gRPC-enabled, you can generate your own gRPC client libraries for it in any gRPC-supported language. To do this, you’ll need the API’s protocol buffers service definition (typically available from our repository on Github). You can then follow the instructions for your preferred language on grpc.io to generate and use your client.

If you don't want to generate your own gRPC code, you can still benefit from gRPC: a growing number of Cloud Client Libraries for gRPC-enabled APIs use gRPC “under the hood” to communicate with Google’s servers. This is significantly more efficient in terms of throughput and CPU usage — accessing an API using gRPC can increase throughput per CPU by as much as a factor of 10 compared to the JSON REST API. We plan to upgrade as many Cloud Client Libraries as possible to gRPC; in the meantime, you’ll still get all the other advantages of our client library code.

Other ways to access Cloud APIs

If you don’t want to access an API programmatically, you can access the same functionality using the tools in Google Cloud SDK, or via the Google Cloud Platform Console.

Send feedback about...