迁移促销活动管理

您可以使用 Merchant Promotions API 在 Google 上创建和管理促销活动。借助 accounts.promotions 资源,您可以展示在 Google 上销售的产品的特别优惠。 如需了解详情,请参阅 商家促销信息 API 概览。

从 Content API for Shopping 到 Merchant API 的变更概览

一个显著的区别是,Content API for Shopping 会在首次插入促销活动时自动创建数据源,而 Merchant API 则不会。如需使用 Merchant API 插入促销活动,您首先 需要创建促销活动数据源

如需了解 promotionDataSource 对象在 accounts.dataSources 资源中的字段,请参阅 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

标识符

在 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_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 万微单位相当于您货币的标准单位。

金额字段名称已从 value 更改为
amountMicros

币种 字段名称已更改为
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,
    ]
    }
  ]
}