Thư viện ứng dụng
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Bạn có thể lựa chọn trong số nhiều thư viện ứng dụng. Hãy xem thêm phần Giải thích về thư viện ứng dụng để biết thêm thông tin chi tiết.
Thư viện ứng dụng đám mây
Bạn nên dùng thư viện ứng dụng vì thư viện này giúp cải thiện khả năng bảo mật và tích hợp ngôn ngữ, đồng thời hỗ trợ việc uỷ quyền người dùng. Thư viện ứng dụng CSS API sử dụng gRPC và được thiết kế để hoạt động với mã mẫu của chúng tôi bằng cùng một ngôn ngữ.
Dưới đây là các thư viện ứng dụng và mã mẫu mới nhất của chúng tôi:
Để thiết lập thư viện ứng dụng, hãy tải xuống và chạy một trong các mã mẫu của chúng tôi.
Thư viện ứng dụng API của Google
Bạn cũng có thể truy cập vào CSS API thông qua Thư viện ứng dụng API của Google.
Điều này cho phép bạn kết nối trực tiếp với giao diện REST.
Ưu điểm so với Thư viện ứng dụng đám mây
- Hỗ trợ các ngôn ngữ khác: Java, Python, PHP, .NET, JavaScript, Objective-C, Dart, Ruby, Node.js, Go
- Hỗ trợ tạo lô: hãy xem tài liệu dành riêng cho thư viện ứng dụng để biết thông tin chi tiết (ví dụ: Python, Java). Tuy nhiên, hầu hết các thư viện Cloud Client đều triển khai các hoạt động tối ưu hoá dành riêng cho ngôn ngữ, khiến việc phân lô thành hàng không cần thiết (ví dụ: nội dung giải thích cho go là vấn đề 675).
- Có trong các thư mục gói mặc định của hầu hết ngôn ngữ lập trình.
Nhược điểm so với Thư viện ứng dụng Cloud
- Cần tự quản lý cuộc gọi và loại dữ liệu
Mã mẫu
Chúng tôi có sẵn Mã mẫu cho các ứng dụng API của Google.
Không có thư viện ứng dụng
Bạn cũng có thể kết nối với CSS API mà không cần bất kỳ thư viện ứng dụng nào bằng cách sử dụng trực tiếp tính năng HTTP của ngôn ngữ lập trình. Hãy tham khảo tài liệu tham khảo về API REST.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\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."]]