从 Content API v2 迁移到 v2.1

2019 年 3 月, 发行日期 2.1 版升级,2021 年 4 月, 公布 v2 将于 2021 年 9 月 30 日停用。版本 v2 已停用。请 立即迁移到 v2.1。

迁移您的应用

从 v2 迁移到 v2.1,需要更新端点网址以调用 新的 v2.1 版本,并修改您的应用以解决破坏性 v2.1 中引入的更改。

将 API 调用更新为使用 v2.1 端点

如需调用 v2.1,请将您的请求更新为使用新的 v2.1 端点。

例如,如需使用 v2 调用 products.get 方法,您可以使用:

GET https://shoppingcontent.googleapis.com/content/v2/merchantId/products/productId

对于 v2.1,请将网址更新为:

GET https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productId

如需全面了解 v2.1 服务和端点,请参阅 API 参考文档

进行所需的更改

除了更新 API 调用的网址外,您还需要更新 来适应 v2.1 中引入的几项破坏性更改。 请查看以下部分,并根据需要更新您的应用。

1. 更新与 inventory 服务的集成

v2 inventory 服务已被移除,等效功能如下 提供以下 v2.1 功能:

2. 更新对 accounts 服务的调用

  • 在 v2.1 中调用 accounts.update 方法会完全覆盖 accounts 资源,而不是仅更新 请求。为避免删除 accounts 资源中的字段,请更新您的调用 请求包含所有字段。

  • reviewsUrl已被移除。

  • 已为“adsLinks”解除关联状态“inactive”, googleMyBusinessLinkyoutubeChannelLinks

3. 更新对 products 服务的调用

  • 自定义属性不再包含类型和单位。单位应为 附加的值和类型。

  • 重复的字段 productTypes 已替换 productTypeadditionalProductTypes

  • 重复的字段 includedDestinationsexcludedDestinations 替换了重复的字段“destinations”。

  • 重命名了以下与 AdWords 相关的字段:

    • adwordsGrouping -> adsGrouping
    • adwordsLabels -> adsLabels
    • adwordsRedirect -> adsRedirect
  • 已移除以下字段:

    • aspects
    • destinations
    • onlineOnly
    • validatedDestinations
    • warnings
  • includeInvalidInsertedItems 参数已移除。在 v2.1 中, 返回的商品。

  • 现在,您插入的商品会有几分钟的延迟 通过 products.getproducts.list 检索。

  • 返回的 offerId 不再保证与 输入 offerId。v2.1 去除了 offerId 并将多个空白字符合并为一个。这项更改 不会影响符合建议值的 offerIdofferId 语法

  • 现在,价格会在商品插入前验证。仅以下 值字符串中允许使用 +-. 和数字(即 0-9)。不再接受英文逗号。

  • products.insertproducts.update 调用的响应仅包含 以下属性:

    • channel
    • contentLanguage
    • id
    • offerId
    • feedLabel
  • v2 选项 includeAttributes 已弃用。请改用 products.getProductId 相关联,以查看完整的商品信息。

4. 更新对 productstatuses 服务的调用

  • 移除了 product 属性,以及 includeAttributes 参数。要检索与状态对应的商品属性, 使用 products 服务并传递新 productId 字段的值。

  • includeInvalidInsertedItems 参数已移除。productId 无论商品是否有效,都会返回退货商品。

  • intentionapprovalStatusapprovalPending 字段 destinationStatuses 已替换为 status,后者是一个字符串, 为 approveddisapprovedpending 中的一个。

  • dataQualityIssues 已替换为 itemLevelIssues

5. 更新对 datafeeds 服务的调用

  • 已替换以下目标字段:

    • contentLanguage -> language
    • targetCountry -> country
    • intendedDestinations ->includedDestinationsexcludedDestinations
  • 具有“contentType = "product inventory update"”的数据 Feed 已被移除。

6. 更新对 ordersTestOrders 服务的调用

  • 在 v2.1 中,调用中不应包含税款数据,因为税款数据是通过计算而来 。履单时是否满足购物平台公平性要求 法案 (MFA) 或类似条款,则包含税务数据的调用失败。如果订单 在非 MFA 州履单,税费是根据在 Merchant Center。如果未配置,则计算出的税费为 0。

  • InStoreRefundLineItemReturnRefundLineItem 字段 amountPretaxamountTax 已替换为 priceAmounttaxAmount, 。priceAmount 可以是税前或税后,具体取决于 订单位置。

  • ShipLineItem字段carriershipmentIdtrackingId 请求已移至 shipmentInfos

  • billingAddresspredefinedBillingAddress 现在是 ordersTestOrder

  • customer.explicitMarketingPreference 已被替换为 customer.marketingRightsInfo

  • netAmount 字段已拆分为 netPriceAmountnetTaxAmount

  • shippingOption 已替换为 lineItems[].shippingDetails

  • CancelLineItem 字段 amountamountPretaxamountTax 该请求已被移除。系统现在会计算退款金额 。

  • 已移除 CustomBatch

  • 移除了 Refund。请改用 refundOrderrefundItem

  • paymentMethod 字段已移除。

  • v2 方法 orders.returnlineitemorders.refund 已被替换为 orderreturns.creatOrderReturnorderreturns.process

  • customer.emailchannelType 和 已移除 lineItem.product.channel 个字段。

  • promotions 字段已从 TestOrder 服务及其 “Order”中的格式已更改。

7. 更新对 orderinvoice 服务的调用

  • amountPretaxamountTax 字段已替换为 priceAmounttaxAmountpriceAmount 字段可以是 pre-tax [税前] 或 税后金额,具体取决于订单的地理位置。

  • 已移除“invoiceSummary”和“Google”中的余额(商家、客户、Google) 与促销扣款相关的字段。

8. 移除了 v2.1 中未包含的功能

v2.1 中的一些其他功能已从 Content API 中移除。评价 以下列表并根据需要更新您的应用:

  • 不再支持 XML。如需详细了解如何切换到 JSON,请参阅 Content API for Shopping 即将停止支持 XML

  • dryRun 参数已移除。此更改适用于所有 API 调用。

  • 已移除所有 HTTP BATCH 方法。请改用 customBatch

  • patch 方法已从以下服务中移除:

    • accounts
    • accounttax
    • datafeeds
    • liasettings
    • shippingsettings
  • orderpayments 服务已被移除。

测试迁移

如需详细了解如何在迁移后测试应用更改 到 v2.1,请参阅 测试 Content API for Shopping 的用途。 如果您在测试更新时遇到问题,可以与我们联系

v2.1 中的其他更改

除了需要更新的变更之外,v2.1 还引入了几项新的 功能和非重大更改:

  • 新服务:

    • 新的 localinventory 服务 在本地更新商品(代替 inventory 服务) 。

    • 新的 orderreturns 服务让 您可以更轻松地管理“在 Google 上购买”(以前称为“购物行动”) 让您可以在不使用 orders 服务的情况下处理退货。

  • 补充 Feed 可让您进行部分商品更新。

  • products 服务进行的其他更改:

    • products.insert 请求不再报告非严重警告或错误。 这样,您就可以插入商品并进行后续更新, 通过 Merchant Center 中的 Feed 规则来发现问题,就像处理 Feed 一样 在 Content API 之外进行管理。

    • 已添加了products.update,以便您更新所选的 一组产品字段。要详细了解可能的用法,请参阅 指南

    • 以下属性的值不再触发插入 错误,并由 productstatus 作为 itemLevelIssues 的一部分返回 服务:

      • ageGroup
      • availability
      • condition
      • energyEfficiencyClass
      • gender
      • maxEnergyEfficiencyClass
      • minEnergyEfficiencyClass
      • sizeSystem
      • sizeType
    • 自定义属性现在是递归属性,因此无需自定义 群组。

    • 除了groupValues 原始的 value 字段。必须设置其中一个字段。