遷移產品管理

你可以使用 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 UI 管理資料來源。

如要進一步瞭解資料來源以及如何建立及管理資料來源,請參閱「Merchant Data sources API 總覽」。

ID 變更

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 中的 ID Merchant Products API 中的 ID
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}