遷移促銷活動管理

你可以使用 Merchant Promotions API,在 Google 建立及管理商家宣傳。accounts.promotions 資源可讓你在 Google 上展示產品特價優惠。詳情請參閱「Merchant Promotions API 總覽」。

從 Content API for Shopping 改用 Merchant API 的異動總覽

兩者的一大差異在於,Content API for Shopping 會在首次插入促銷活動時自動建立資料來源,而 Merchant API 則不會。如要使用 Merchant API 插入促銷活動,請先建立促銷活動資料來源。

如要瞭解 accounts.dataSources 資源中 promotionDataSource 物件的欄位,請參閱 PromotionDataSource。

現有資料來源

如果是現有資料來源,但您不知道 accounts.dataSources.name,請使用 dataSources.list 擷取。

或者,您也可以使用 accounts.promotions.get 方法,並檢查帳戶中任何現有促銷活動回應中的 dataSource 欄位,找出各項促銷活動的資料來源。

如要在日後的 API 呼叫中直接參照,強烈建議您將每個促銷活動的 accounts.dataSources.name 儲存在本機資料庫中。

要求

如要提出要求,請使用下列網址。

POST https://merchantapi.googleapis.com/promotions/v1/{ACCOUNT_NAME}/promotions

從 Content API for Shopping 遷移

以下比較 Content API for Shopping 和商家宣傳 API 處理促銷活動相關要求的差異。

網址

在 Content API for Shopping 中:

https://shoppingcontent.googleapis.com/content/v2.1/{MERCHANT_ID}/promotions

在 Merchant API 中會變成:

https://merchantapi.googleapis.com/promotions/v1/{parent=accounts/*}/promotions

ID

在 Content API for Shopping 中:

{MERCHANT_ID}/promotions/{PROMOTION_ID}

在 Merchant API 中會變成:

{NAME}

方法

Merchant API 支援下列促銷活動方法:

  • 插入促銷內容
  • 取得促銷活動
  • 列出促銷活動

以下比較 Content API for Shopping 和 Merchant API 支援的促銷活動方法:

功能 Content API for Shopping Merchant API
網址 https://shoppingcontent.googleapis.com/content/v2.1/{MERCHANT_ID}/promotions https://merchantapi.googleapis.com/promotions/v1/{parent=accounts/*}/promotions
ID {MERCHANT_ID}/promotions/{PROMOTION_ID} {NAME}
方法
  • insert
  • get
  • list
  • customBatch
  • delete
  • insert
  • get
  • list

欄位變更

下表列出 Merchant Promotions API 中商家宣傳的異動。

如需參考範例,請參閱 accounts.promotions。

Content API for Shopping Merchant API 說明
(不支援) custom_attributes 自訂 (使用者提供) 屬性的清單。
你也可以使用這項屬性,以一般形式提交動態饋給規格的任何屬性。

例如:
{
  "name": "size type", "value": "regular"
}
如要提交 API 未明確公開的屬性,這個方法非常實用。
不支援 data_source 必須有現有資料來源,才能建立促銷活動。
不支援 屬性 促銷活動專屬屬性,例如
long_tile、promotion_effective_timeperiod
等,都是屬性訊息的一部分。
item_id item_id_inclusion 促銷活動適用的項目 ID 清單已重新命名。
store_id store_id_inclusion 促銷活動適用的商店 ID 清單
已重新命名。
product_type product_type_inclusion 促銷活動適用的產品類型清單
已重新命名。
item_group_id item_group_id_inclusion 促銷活動適用的商品群組 ID 清單
已重新命名。
brand brand_inclusion 促銷活動適用的品牌清單
已重新命名。
store_code store_codes_inclusion 促銷活動適用的商店代碼清單
已重新命名。
price:
  {
    object (Price)
  }
price:
  {
    object (Price)
  }
價格的定義已變更。

在 Content API for Shopping 中,Price
是字串形式的小數。

價格金額現在會以微量單位記錄,
100 萬微量單位相當於貨幣的
標準單位。

amount 欄位名稱已從 value 變更為
amountMicros。

currency 欄位名稱已變更為
currencyCode。格式仍為
ISO 4217。(維基百科)

order_limit (不支援) 不支援 order_limit 屬性。
shippingServiceNames[] (不支援) 不支援 shippingServiceNames[]。
money_budget (不支援) 不支援 money_budget。
promotion_destination_ids promotion_destinations promotionDestinationIds 已重新命名。
促銷活動狀態
{
  "destinationStatuses": [
    {
      "destination": string,
      "status": enum (State)
    }
  ],
  "promotionIssue": [
    {
    "code": string,
    "detail": string
    }
  ],
  "creationDate": string,
  "lastUpdateDate": string
}
促銷活動狀態已變更。
如要查看更詳細的資訊,請前往「問題」頁面。
promotionStatus = {
  destinationStatuses = [
     {
     reportingContext = Enum
     status = Enum
     },
  ],
  itemLevelIssues = [
    {
    code = String
    severity = Enum
    resolution = String
    reportingContext = Enum
    description = String
    detail = String
    documentation = String applicableCountries = [
      String,
    ]
    }
  ]
}