迁移商品管理

您可以使用 Merchant API 以编程方式上传和管理商品。借助 accounts.products 资源,您可以创建网店商品目录,即商品和优惠列表。如需详细了解如何使用 Merchant API 上传和管理商品,请参阅 Merchant Products API 概览

资源更改

Content API 的 productsproductstatuses 资源已替换为 productInputsproducts 资源。

您可以使用 Merchant API 的 productInputs 资源上传商品信息。Merchant API 的 product 资源可用于检索已处理的商品(包括状态)。

数据源要求

在 Merchant API 中,上传商品时必须指定目标数据源。这可以是主要数据源,也可以是补充数据源。您可以使用 dataSources.list 检索现有数据源,也可以使用 dataSources.create 创建新数据源。

或者,您也可以使用 Merchant Center 界面管理数据源。

如需详细了解数据源以及如何创建和管理数据源,请参阅 Merchant Data Sources API 概览

标识符更改

Merchant API 使用名称来标识商品。商品名称将采用 accounts/{account}/products/{product} 格式,其中 {product} 采用 channel~language~feedLabel~offerId 格式。

Content API 资源在 ID 中的每个值之间使用 :(而非 ~):channel:language:feedLabel:offerId

所有 Merchant API 调用都会返回新格式,其中 ID 值之间会插入 ~。我们建议您存储响应中的新 name 字段,并在日后的调用中使用该字段。

方法

下面对比了 Content API for Shopping 和 Merchant Products API 中的商品方法:

请求

Content API 方法 Content API for Shopping 中的网址 Merchant Products API 中的网址 Content API 中的标识符 Merchant Products API 中的标识符
products.insert POST https://shoppingcontent.googleapis.com/content/v2.1/{MERCHANT_ID}/products POST https://merchantapi.googleapis.com/products/v1beta/{PARENT}/productsInputs:insert?dataSource=accounts/{MERCHANT_ID}/dataSources/{DATASOURCE_ID} MERCHANT_ID PARENT=accounts/{MERCHANT_ID}
products.update PATCH https://shoppingcontent.googleapis.com/content/v2.1/{MERCHANT_ID}/products/{PRODUCT_ID} 不可用
products.delete DELETE https://shoppingcontent.googleapis.com/content/v2.1/{MERCHANT_ID}/products/{PRODUCT_ID} DELETE https://merchantapi.googleapis.com/products/v1beta/{NAME}?dataSource=accounts/{MERCHANT_ID}/dataSources/{DATASOURCE_ID} MERCHANT_IDPRODUCT_ID NAME=accounts/{MERCHANT_ID}/productInputs/{PRODUCT_ID_WITH_TILDES}
products.get GET https://shoppingcontent.googleapis.com/content/v2.1/{MERCHANT_ID}/products/{PRODUCT_ID} GET https://merchantapi.googleapis.com/products/v1beta/{NAME} MERCHANT_IDPRODUCT_ID NAME=accounts/{MERCHANT_ID}/products/{PRODUCT_ID_WITH_TILDES}
products.list GET https://shoppingcontent.googleapis.com/content/v2.1/{MERCHANT_ID}/products GET https://merchantapi.googleapis.com/products/v1beta/{PARENT}/products MERCHANT_ID PARENT=accounts/{MERCHANT_ID}
productstatuses.get GET https://shoppingcontent.googleapis.com/content/v2.1/{MERCHANT_ID}/productstatuses/{PRODUCT_ID} GET https://merchantapi.googleapis.com/products/v1beta/{NAME} MERCHANT_IDPRODUCT_ID NAME=accounts/{MERCHANT_ID}/products/{PRODUCT_ID_WITH_TILDES}
productstatuses.list GET https://shoppingcontent.googleapis.com/content/v2.1/{MERCHANT_ID}/productstatuses GET https://merchantapi.googleapis.com/products/v1beta/{PARENT}/products MERCHANT_ID PARENT=accounts/{MERCHANT_ID}