迁移促销活动管理

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

标识符

在 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 创建促销活动需要有现有的数据源。
不支持 属性 促销活动专用属性(例如
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 字段名称已从 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,
    ]
    }
  ]
}