遷移促銷活動管理

你可以使用 Merchant Promotions API,在 Google 上建立及管理商家宣傳。你可以使用 accounts.promotions 資源,在 Google 上展示所售產品的特價優惠。詳情請參閱商家宣傳 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 呼叫中直接參照這些 ID,強烈建議您為每項促銷活動將 accounts.dataSources.name 儲存在本機資料庫中。

要求

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

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

從 Content API for Shopping 遷移

下表比較 Content API for Shopping 與 Merchant Promotions 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_tilepromotion_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 中,價格
是字串形式的十進位數字。

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

「amount」欄位名稱已變更為「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,
    ]
    }
  ]
}