rocket
隆重推出
Merchant API - Content API for Shopping 的正式替代方案。
update
获取最新资讯,了解 Merchant API 的新功能、问题修复和更新。
add_alert
注意:Content API for Shopping 将于 2026 年 8 月 18 日停用。
测试商品资源
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
您可以参考下面这些示例,通过
products
资源。
添加产品
为网站构建有效的 JSON 文件
产品。
创建 insert
请求
替换为商品数据和您的商家 ID:
POST https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products
验证您是否收到 HTTP 200
状态代码。
查看商品
创建 get
请求
以及商品的 ID
productId:
GET https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productId
验证您是否收到 HTTP 200
状态代码以及
产品。
更新商品
为商品构建新的 JSON。例如,将
JSON availability: in stock
设置为 availability: out of stock
,以获取
用于测试 insert
调用的产品。
创建 insert
请求
替换为新的商品数据和您的商家 ID:
POST https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products
验证您是否收到 HTTP 200
状态代码。至少五次以上
您可以再发出一个 get
请求来确认更新后的值,
已应用“availability: out of stock
”。
删除商品
创建 delete
请求
以及商品的 ID
productId
:
DELETE https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productId
验证您是否收到 HTTP 204
状态代码。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eThis page provides examples of how to interact with the \u003ccode\u003eproducts\u003c/code\u003e resource using the Content API for Shopping.\u003c/p\u003e\n"],["\u003cp\u003eYou can add a new product by constructing valid JSON and making an \u003ccode\u003einsert\u003c/code\u003e request.\u003c/p\u003e\n"],["\u003cp\u003eView an existing product using a \u003ccode\u003eget\u003c/code\u003e request with your merchant ID and the product ID.\u003c/p\u003e\n"],["\u003cp\u003eUpdate a product's information by making an \u003ccode\u003einsert\u003c/code\u003e request with the updated JSON data.\u003c/p\u003e\n"],["\u003cp\u003eDelete a product using a \u003ccode\u003edelete\u003c/code\u003e request with your merchant ID and the product ID.\u003c/p\u003e\n"]]],["To add a product, create valid JSON for it, then send an `insert` request via POST with the data and merchant ID, expecting an `HTTP 200` response. To view, send a `get` request via GET with the merchant ID and product ID, confirming an `HTTP 200` status and the JSON. To update, create new JSON, make an `insert` POST request, and verify `HTTP 200` then check with `get`. To delete, send a `delete` request via DELETE with the ID, verifying an `HTTP 204` status.\n"],null,["# Testing the products resource\n\nHere are some examples you can use to test your implementation with the\n`products` resource.\n\nAdd a product\n-------------\n\n1. Construct [valid JSON for a\n product](/shopping-content/reference/rest/v2.1/products#resource:-product).\n\n2. Make an [`insert`\n request](/shopping-content/reference/rest/v2.1/products/insert#http-request)\n with the product data and your merchant ID:\n\n POST https://shoppingcontent.googleapis.com/content/v2.1/\u003cvar translate=\"no\"\u003emerchantId\u003c/var\u003e/products\n\n3. Verify that you receive an `HTTP 200` status code.\n\nView a product\n--------------\n\n1. Make a [`get`\n request](/shopping-content/reference/rest/v2.1/products/get#http-request)\n with your merchant ID, and the product's\n [productId](/shopping-content/guides/products/product-id):\n\n GET https://shoppingcontent.googleapis.com/content/v2.1/\u003cvar translate=\"no\"\u003emerchantId\u003c/var\u003e/products/\u003cvar translate=\"no\"\u003eproductId\u003c/var\u003e\n\n2. Verify that you receive an `HTTP 200` status code, and the JSON data for the\n product.\n\nUpdate a product\n----------------\n\n1. Construct the new JSON for a product. For example, change a single field in\n the JSON `availability: in stock`, to `availability: out of stock` for the\n product you used to test the `insert` call.\n\n2. Make an [`insert`\n request](/shopping-content/reference/rest/v2.1/products/insert#http-request)\n with the new product data and your merchant ID:\n\n POST https://shoppingcontent.googleapis.com/content/v2.1/\u003cvar translate=\"no\"\u003emerchantId\u003c/var\u003e/products\n\n3. Verify that you receive an `HTTP 200` status code. After at least five\n minutes, you can make another `get` request to confirm the updated value,\n `availability: out of stock`, was applied.\n\nDelete a product\n----------------\n\n1. Make a [`delete`\n request](/shopping-content/reference/rest/v2.1/products/delete#http-request)\n with your merchant ID, and the product's\n [`productId`](/shopping-content/guides/products/product-id):\n\n DELETE https://shoppingcontent.googleapis.com/content/v2.1/\u003cvar translate=\"no\"\u003emerchantId\u003c/var\u003e/products/\u003cvar translate=\"no\"\u003eproductId\u003c/var\u003e\n\n2. Verify that you receive an `HTTP 204` status code."]]