用戶端程式庫
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
您可以選擇多種不同的用戶端程式庫。詳情請參閱用戶端程式庫說明。
Cloud 用戶端程式庫
建議您使用用戶端程式庫,因為這類程式庫提供更完善的安全性與語言整合,且支援使用者授權。CSS API 用戶端程式庫使用 gRPC,並旨在以相同語言與我們的程式碼範例搭配使用。
以下是最新的用戶端程式庫和程式碼範例:
如要設定用戶端程式庫,請下載並執行我們的其中一個程式碼範例。
Google API 用戶端程式庫
您也可以透過 Google API 用戶端程式庫存取 CSS API。這可讓您直接連線至 REST 介面。
Cloud 用戶端程式庫的優點
- 支援其他語言:Java、Python、PHP、.NET、JavaScript、Objective-C、Dart、Ruby、Node.js、Go
- 支援批次處理:詳情請參閱用戶端程式庫專屬說明文件 (例如:Python、Java)。即便如此,大部分的 Cloud 用戶端程式庫都會實作特定語言專屬的最佳化作業,造成不必要的批次處理 (例如問題 675 中的範例說明)。
- 適用於大部分程式設計語言的預設套件目錄。
Cloud 用戶端程式庫的缺點
程式碼範例
我們提供了 Google API 用戶端的程式碼範例。
沒有任何用戶端程式庫
您也可以直接使用程式設計語言的 HTTP 功能,在沒有任何用戶端程式庫的情況下連線至 CSS API。請參閱 REST API 參考資料。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eThe Content API for Shopping provides client libraries for easier integration and enhanced security.\u003c/p\u003e\n"],["\u003cp\u003eCloud Client Libraries in Java, PHP, Go, Ruby, .NET, Python, and Node.js are available with corresponding code samples where applicable.\u003c/p\u003e\n"],["\u003cp\u003eGoogle API Client Libraries offer broader language support and batching capabilities but require manual call and data type management.\u003c/p\u003e\n"],["\u003cp\u003eDirect HTTP connection to the REST API is possible without a client library, offering maximum flexibility.\u003c/p\u003e\n"]]],[],null,["# Client libraries\n\nYou have the choice between multiple different client libraries. See also\n[Client libraries explained](https://cloud.google.com/apis/docs/client-libraries-explained)\nfor more details.\n\nCloud Client Libraries\n----------------------\n\nWe recommend using a client library, because they provide improved security and\nlanguage integration, and support user authorization. The CSS API client\nlibraries use gRPC and are designed to work with our [code\nsamples](/comparison-shopping-services/api/code-samples) in the same language.\n\nHere are our most recent client libraries and code samples:\n\n| Client libraries | Code samples |\n|-------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|\n| [Java](https://central.sonatype.com/artifact/com.google.shopping/google-shopping-css) | [Java](//github.com/googleads/comparison-shopping-service-api-samples/tree/main/java) |\n| [PHP](https://packagist.org/packages/google/shopping-css) | |\n| [Go](https://cloud.google.com/go/docs/reference/cloud.google.com/go/shopping/latest/css/apiv1/) | |\n| [Ruby](https://rubygems.org/gems/google-shopping-css-v1/) | |\n| [.NET](https://www.nuget.org/packages/Google.Shopping.Css.V1/) | |\n| [Python](https://pypi.org/project/google-shopping-css/) | |\n| [Node.js](https://www.npmjs.com/package/@google-shopping/css) | |\n\nTo set up a client library, download and run one of our code samples.\n\nGoogle API Client Libraries\n---------------------------\n\nYou can also access the CSS API through the [Google API Client\nLibraries](https://developers.google.com/api-client-library/).\nThis lets you to connect to the\n[REST](/comparison-shopping-services/api/reference/rest) interface directly.\n\n### Advantages over the Cloud Client Libraries\n\n- Supports additional languages: Java, Python, PHP, .NET, JavaScript, Objective-C, Dart, Ruby, Node.js, Go\n- Supports batching: see the client library specific documentation for details (examples: [Python](https://github.com/googleapis/google-api-python-client/blob/main/docs/batch.md \"Batching in Python\"), [Java](https://googleapis.github.io/google-api-java-client/batching.html \"Batching in Java\")). That said, most of the Cloud Client libraries implement language specific optimizations that make batching unnecessary (example explanation for go is in [issue\n 675](https://github.com/googleapis/google-cloud-go/issues/675)).\n- Available in the default package directories of most programming languages.\n\n### Disadvantages over the Cloud Client Libraries\n\n- Need to manage calls and data types yourself\n\n### Sample Code\n\nWe have [Sample code for Google API\nclients](/comparison-shopping-services/api/code-samples/gapi) available.\n\nNo client library\n-----------------\n\nYou can also connect to the CSS API without any client library, using the HTTP\ncapabilities of your programming language directly. Refer to the\n[REST API](/comparison-shopping-services/api/reference/rest) reference."]]