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 功能:
使用新的补充数据 Feed 或
products.update
部分商品更新。更新适用于所有可变的 商品字段,包括之前使用inventory.set
(不包括localinventory
的专有项)。请参阅 迁移到补充数据 Feed 了解详情。使用新的
localinventory
服务 了解本地产品最新动态。
2. 更新对 accounts
服务的调用
在 v2.1 中调用
accounts.update
方法会完全覆盖accounts
资源,而不是仅更新 请求。为避免删除accounts
资源中的字段,请更新您的调用 请求包含所有字段。reviewsUrl
已被移除。已为“
adsLinks
”解除关联状态“inactive
”,googleMyBusinessLink
和youtubeChannelLinks
。
3. 更新对 products
服务的调用
自定义属性不再包含类型和单位。单位应为 附加的值和类型。
重复的字段
productTypes
已替换productType
和additionalProductTypes
。重复的字段
includedDestinations
和excludedDestinations
替换了重复的字段“destinations
”。重命名了以下与 AdWords 相关的字段:
adwordsGrouping
->adsGrouping
adwordsLabels
->adsLabels
adwordsRedirect
->adsRedirect
已移除以下字段:
aspects
destinations
onlineOnly
validatedDestinations
warnings
includeInvalidInsertedItems
参数已移除。在 v2.1 中, 返回的商品。现在,您插入的商品会有几分钟的延迟 通过
products.get
或products.list
检索。返回的
offerId
不再保证与 输入offerId
。v2.1 去除了offerId
并将多个空白字符合并为一个。这项更改 不会影响符合建议值的offerId
值offerId
语法。现在,价格会在商品插入前验证。仅以下 值字符串中允许使用
+
、-
、.
和数字(即0
-9
)。不再接受英文逗号。products.insert
或products.update
调用的响应仅包含 以下属性:channel
contentLanguage
id
offerId
feedLabel
v2 选项
includeAttributes
已弃用。请改用products.get
与ProductId
相关联,以查看完整的商品信息。
4. 更新对 productstatuses
服务的调用
移除了
product
属性,以及includeAttributes
参数。要检索与状态对应的商品属性, 使用products
服务并传递新productId
字段的值。includeInvalidInsertedItems
参数已移除。productId
无论商品是否有效,都会返回退货商品。intention
、approvalStatus
和approvalPending
字段destinationStatuses
已替换为status
,后者是一个字符串, 为approved
、disapproved
或pending
中的一个。dataQualityIssues
已替换为itemLevelIssues
。
5. 更新对 datafeeds
服务的调用
已替换以下目标字段:
contentLanguage
->language
targetCountry
->country
intendedDestinations
->includedDestinations
和excludedDestinations
具有“
contentType = "product inventory update"
”的数据 Feed 已被移除。
6. 更新对 orders
和 TestOrders
服务的调用
在 v2.1 中,调用中不应包含税款数据,因为税款数据是通过计算而来 。履单时是否满足购物平台公平性要求 法案 (MFA) 或类似条款,则包含税务数据的调用失败。如果订单 在非 MFA 州履单,税费是根据在 Merchant Center。如果未配置,则计算出的税费为 0。
InStoreRefundLineItem
和ReturnRefundLineItem
字段amountPretax
和amountTax
已替换为priceAmount
和taxAmount
, 。priceAmount
可以是税前或税后,具体取决于 订单位置。ShipLineItem
字段carrier
、shipmentId
和trackingId
请求已移至shipmentInfos
。billingAddress
和predefinedBillingAddress
现在是orders
和TestOrder
。customer.explicitMarketingPreference
已被替换为customer.marketingRightsInfo
。netAmount
字段已拆分为netPriceAmount
和netTaxAmount
。shippingOption
已替换为lineItems[].shippingDetails
。CancelLineItem
字段amount
、amountPretax
和amountTax
该请求已被移除。系统现在会计算退款金额 。已移除
CustomBatch
。移除了
Refund
。请改用refundOrder
或refundItem
。paymentMethod
字段已移除。v2 方法
orders.returnlineitem
和orders.refund
已被替换为orderreturns.creatOrderReturn
和orderreturns.process
。customer.email
、channelType
和 已移除lineItem.product.channel
个字段。promotions
字段已从TestOrder
服务及其 “Order
”中的格式已更改。
7. 更新对 orderinvoice
服务的调用
amountPretax
和amountTax
字段已替换为priceAmount
和taxAmount
。priceAmount
字段可以是 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
字段。必须设置其中一个字段。