クライアント ライブラリを使用すると、サポートされている言語から 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-09 UTC。"],[[["\u003cp\u003eCloud Client Libraries are the recommended method for accessing Cloud APIs programmatically, offering idiomatic code, consistent style, and handling low-level server communication.\u003c/p\u003e\n"],["\u003cp\u003eGoogle API Client Libraries serve as an alternative for APIs that lack Cloud Client Libraries in certain languages, providing access to the REST interface only, but with autogenerated interface code.\u003c/p\u003e\n"],["\u003cp\u003eFirebase SDK provides client code for accessing mobile-relevant Cloud APIs from iOS, Android, and Web applications, which is the go to solution for mobile device application development.\u003c/p\u003e\n"],["\u003cp\u003eExperienced developers can opt to write their own custom code to directly interact with the service's lower-level APIs, using the JSON/REST interface or gRPC.\u003c/p\u003e\n"],["\u003cp\u003egRPC-enabled Cloud APIs offer a performance advantage through the use of protocol buffers and gRPC over HTTP2, with some Cloud Client Libraries leveraging gRPC for improved efficiency.\u003c/p\u003e\n"]]],[],null,["# Client libraries explained\n\nClient libraries make it easier to access\n[Google Cloud APIs](/apis/docs/overview)\nfrom a supported language. While you can use Google Cloud APIs directly\nby making raw requests to the server, client libraries provide simplifications\nthat significantly reduce the amount of code you need to write.\n\nThis document explains the different types of client libraries that Google\nprovides for Cloud APIs. You can also find out more about the available\nlibraries for your product or language of choice in the product or language's\ndocumentation.\n\nCloud Client Libraries\n----------------------\n\n[Cloud Client Libraries](/apis/docs/cloud-client-libraries)\nare the recommended option for accessing Cloud APIs programmatically, where\navailable. Cloud Client Libraries use the latest client library model and:\n\n- Provide idiomatic code in each language to make Cloud APIs simple and intuitive to use.\n- Provide a consistent style across client libraries to simplify working with multiple Cloud services.\n- Handle all the low-level details of communication with the server, including [authenticating with Google](/docs/authentication/client-libraries).\n- Can be installed using familiar package management tools such as `npm` and `pip`.\n- In some cases, give you performance benefits by using gRPC. For more information, see the [gRPC APIs](#grpc_apis).\n\nYou can find installation instructions and reference material for the\nCloud Client Library on the Client Libraries page for the\n[Cloud API](/apis/docs/overview)s\nyou're using. You can find links to get started with the\nCloud Client Libraries and their reference documentation on the\n[Cloud Client Libraries page](/apis/docs/cloud-client-libraries).\n\nTry it for yourself\n-------------------\n\n\nIf you're new to Google Cloud, create an account to evaluate how our\nproducts perform in real-world scenarios. New customers also get $300 in\nfree credits to run, test, and deploy workloads.\n[Get started for free](https://console.cloud.google.com/freetrial)\n\nGoogle API Client Libraries\n---------------------------\n\nA few Google Cloud APIs don't have Cloud Client Libraries available in all\nlanguages. If you want to use one of these APIs and there is no\nCloud Client Library for your preferred language, you can still use the previous\nstyle of client library, called\n[Google API Client Libraries](https://developers.google.com/api-client-library/).\nYou might also use these libraries if you're upgrading a project that already\nuses them. These libraries:\n\n- Provide access to the API's REST interface only; gRPC is not supported.\n- Have autogenerated interface code that might not be as idiomatic as the Cloud Client Libraries.\n- Handle all the low-level details of communication with the server, including [authenticating with Google](/docs/authentication/client-libraries).\n- Can be installed using familiar package management tools such as `npm` and `pip`.\n\nThese libraries are linked on the Client Libraries page for the relevant Cloud\nAPIs.\n\nUsing the Firebase mobile platform\n----------------------------------\n\nFirebase is the Google-wide solution for building applications on mobile\ndevices. It offers an SDK with client code that lets you access mobile-relevant\nCloud APIs from iOS, Android, and Web apps. For information on the supported\nCloud APIs and how to get started with Firebase, see the\n[Firebase documentation](https://firebase.google.com/docs).\n\nUsing your own client code\n--------------------------\n\nIf you're an experienced developer and Google's client libraries don't meet your\nspecific needs, you can write your own custom code to access the service's\nlower-level service APIs directly.\n\n### REST/HTTP APIs\n\nAll Cloud APIs expose a simple traditional JSON/REST interface. If you need to\nwrite your own custom code to directly access the REST API using a third-party\nHTTP client library, you can find out more about how Cloud APIs work with\ndifferent HTTP versions and implementations in the\n[HTTP Guidelines](/apis/docs/http).\n\n### gRPC APIs\n\ngRPC is a language-neutral, platform-neutral, open source, remote procedure call\n(RPC) system initially developed at Google. You can find out about it at\n[grpc.io](http://www.grpc.io/).\ngRPC-enabled Cloud APIs generally have both REST and RPC interfaces, so rather\nthan just using JSON over HTTP to talk to the REST interface, gRPC-enabled API\nclients can also use\n[protocol buffers](https://developers.google.com/protocol-buffers/)\nand gRPC over HTTP2 to talk to the RPC interface. You can find out if an API is\ngRPC-enabled by checking its APIs and Reference section.\n\nIf a Cloud API is gRPC-enabled, you can generate your own gRPC client libraries\nfor it in any gRPC-supported language. To do this, you'll need the API's\n[protocol buffers](https://developers.google.com/protocol-buffers/)\nservice definition (typically available from\n[the repository on GitHub](https://github.com/googleapis/googleapis)).\nYou can then follow the instructions for your preferred language on\n[grpc.io](http://www.grpc.io/)\nto generate and use your client.\n\nIf you don't want to generate your own gRPC code, you can still benefit from\ngRPC: a growing number of Cloud Client Libraries for gRPC-enabled APIs use gRPC\n\"under the hood\" to communicate with Google's servers. This is significantly\nmore efficient in terms of throughput and CPU usage --- accessing an API\nusing gRPC can increase throughput per CPU by as much as a factor of 10 compared\nto the JSON REST API. Google plans to upgrade as many Cloud Client Libraries as\npossible to gRPC; in the meantime, you'll still get all the other advantages of\nGoogle's client library code.\n\nOther ways to access Cloud APIs\n-------------------------------\n\nIf you don't want to access an API programmatically, you can access some\nof the same functionality using the tools in\n[Google Cloud CLI](/sdk/docs) or using the\n[Google Cloud console](https://console.cloud.google.com/)."]]