您可以使用 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。
请求
如需发出请求,请使用以下网址。
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} | 
| 方法 | 
 | 
 | 
字段更改
下表显示了 Merchant Promotions API 中促销的变更。
如需查看示例以供参考,请参阅本地商品目录。
| Content API for Shopping | Merchant API | 说明 | 
|---|---|---|
| (不支持) | custom_attributes | 自定义(用户提供)属性的列表。您还可以使用它以通用形式提交 Feed 规范的任何属性。 例如: 
{
  "name": "size type", "value": "regular"
}
 | 
| 不支持 | 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 中,价格
    
  现在,价格金额以微单位记录, 
  amount 字段名称已从 value 更改为  
  currency 字段名称已更改为  | 
| 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,
    ]
    }
  ]
}
 | |