迁移促销活动管理

您可以使用 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 与 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

标识符

在 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
标识符 {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 自定义(用户提供)属性的列表。您还可以使用它以通用形式提交 Feed 规范的任何属性。


例如:
{
  "name": "size type", "value": "regular"
}
这对于提交 API 未明确公开的属性非常有用。
不支持 data_source 创建促销活动需要有现有数据源。
不支持 attributes 促销活动特定属性(例如
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,
    ]
    }
  ]
}