Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

API for Google Cloud Platform: gcloud API or Google API Client

I am working with google cloud platform. Learning and trying out a few things like Bigquery and Google Cloud Storage.

I find it confusing that there are two official APIs for all those things: gcloud API and Google API Python Client. In google cloud's "getting started" tutorial, the recommended API is Google API (Python) Client and it seems that the documentation for gcloud api is not very detailed.

In short, to access Google Cloud Platform programmatically,

  1. which api library is better?
  2. Where can I find nice documentation for that?
like image 508
Yuqing Avatar asked Dec 06 '25 18:12

Yuqing


1 Answers

My answer

I would recommend gcloud API, this choice also applies to other languages: nodejs, ruby.... And then

Explanations

It is confusing, that Google have these two APIs have overlapping functionalities. And it is more confusing that they use Google API Client in their tutorial, while gcloud seems to be a more Google Cloud SDK specific package.

Here is what I found out: on the page of the gcloud API page, there is this FAQ section saying:

The Google APIs Python Client is a client library for using the broad set of Google APIs. gcloud-python is built specifically for the Google Cloud Platform and is the recommended way to integrate Google Cloud APIs into your Python applications. If your application requires both Google Cloud Platform and other Google APIs, the 2 libraries may be used by your application.

Addtionally, the gcloud api is part of the Google Cloud SDK. So it is standard.

Both the gcloud command-line tool and gcloud-python package are a part of the Google Cloud SDK: a collection of tools and libraries that enable you to easily create and manage resources on the Google Cloud Platform. The gcloud command-line tool can be used to manage both your development workflow and your Google Cloud Platform resources while the gcloud-python package is the Google Cloud Client Library for Python.

Based on my experience of using the python and nodejs api, the gcloud api is much more easier to use than the google api client. Here is another question for your reference:

When accessing Bigquery using Python API, what is the difference of using google client API and gcloud

So obviously, for a project working around Google Cloud Platform, using the gcloud API is an better choice.

Documentation

What about the documentation? The documentation seems not very helpful(especially for rookie programmer like me) if you look at a page like this: https://googlecloudplatform.github.io/gcloud-python/#/docs/master/gcloud/storage/blob/blob

I found two ways to get more detailed instructions: look for the doc for stable version or go to the github page. For instance:

  1. https://googlecloudplatform.github.io/gcloud-python/stable/storage-blobs.html
  2. https://github.com/GoogleCloudPlatform/gcloud-python

This is the result of the little research I did on it. I am still curious why Google mention gcloud library so little in its tutorials. Anyway, I hope this will help people to get an idea of which library to use, and save some time researching on it.

like image 118
Yuqing Avatar answered Dec 08 '25 13:12

Yuqing