迁移账号关联

账号关系的管理已从 Content API for Shopping 中的单一 link 方法发展为 Merchant API 中更精细且更明确的系统。新 API 使用 AccountRelationshipAccountService 等专用资源来定义一个账号向另一个账号提供的特定服务。如需了解详情,请参阅账号之间的关系

主要差异

  • 用于表示关系和服务关系的专用资源:在 Merchant API 中,AccountRelationship 资源用于定义服务提供商与商家之间的连接,而 AccountService 资源用于指定所提供的确切服务(例如 accountAggregation)。这取代了 Content API for Shopping 中的通用 linkTypeservices 字段。
  • 显式操作方法:Merchant API 不使用带 action 参数的单个 link 方法,而是使用不同的方法来管理服务,例如 proposeapprovereject
  • 专用 Google 商家资料关联:关联到 Google 商家资料之前是通过设置 googleMyBusinessLink 字段来处理的,现在有了一个专用方法 gbpAccounts.linkGbpAccount
  • 将创建客户账号作为一项服务:现在,在高级账号下创建客户账号会被视为使用 accounts.createAndConfigure 方法提议 accountAggregation 服务。如需详细了解账号,请参阅商家账号 API 页面。由于用户有权访问高级账号和客户账号,因此无需进行握手。

请求

Merchant API 提供了用于管理不同类型的账号关联和服务的一些特定端点:

商家 API 请求网址

  • 建议新服务POST https://merchantapi.googleapis.com/accounts/v1/ {parent=accounts/*}/services:propose
  • 批准服务POST https://merchantapi.googleapis.com/accounts/v1/ {name=accounts/*/services/*}:approve
  • 拒绝服务POST https://merchantapi.googleapis.com/accounts/v1/ {name=accounts/*/services/*}:reject
  • 链接到 Google 商家资料POST https://merchantapi.googleapis.com/accounts/v1/ {parent=accounts/*}/gbpAccounts:linkGbpAccount
  • 创建客户账号(账号汇总链接)POST https://merchantapi.googleapis.com/accounts/v1/ accounts:createAndConfigure

请求网址比较

请求说明 Content API for Shopping Merchant API
关联账号(例如,第三方平台) POST .../v2.1/{merchantId}/accounts/{accountId}/link POST .../v1/{parent=accounts/*}/services:propose
关联到 Google 商家资料 PUT .../v2.1/{merchantId}/accounts/{accountId}(带有 googleMyBusinessLink 字段) POST .../v1/{parent=accounts/*}/gbpAccounts:linkGbpAccount
创建客户账号 POST .../v2.1/{merchantId}/accounts POST .../v1/accounts:createAndConfigure

方法

Content API for Shopping 方法 Merchant API 方法 适用范围和备注
accounts.link accountServices.propose 使用此方法可使用其他账号启动新服务。
accounts.link(带 action: "approve" accountServices.approve 使用此方法可批准待处理的服务提案。
accounts.link(带 action: "remove" accountServices.reject 使用此方法可拒绝待处理或已建立的服务。
accounts.insert(适用于客户账号) accounts.createAndConfigure 将此方法与 accountAggregation 服务搭配使用,以在高级账号下创建新的客户账号。
accounts.update(带 googleMyBusinessLink gbpAccounts.linkGbpAccount 使用此专用方法将 Merchant Center 账号与 Google 商家资料相关联。
accounts.update(带 adsLinks AccountRelationship 项资源 与 Google Ads 的关联是在 Google Ads 界面中进行管理的。生成的链接在 Merchant API 中表示为 AccountRelationship,可以查看但无法直接创建。

详细的字段更改

Content API for Shopping Merchant API 说明
AccountsLinkRequest.action proposeapprovereject 方法 单个 action 字段已替换为用于处理服务生命周期中每种状态变化的专用 API 方法。
AccountsLinkRequest.linkType AccountService.service_type 通用 linkType 字符串被 AccountService 资源中的结构化 service_type oneof 字段(例如 productsManagementaccountAggregation)取代
AccountsLinkRequest.services AccountService.service_type 基于字符串的服务的列表现在由 AccountService 资源中选择的特定 service_type 表示。
AccountsLinkRequest.linkedAccountId ProposeAccountServiceRequest.provider 提供服务的账号的 ID 现在已在 propose 请求的 provider 字段中指定。
Account.googleMyBusinessLink LinkGbpAccountRequest 包含 GBP 链接详细信息的对象已替换为 linkGbpAccount 方法的专用请求消息。
Account.adsLinks AccountRelationship Google Ads 链接表示为 AccountRelationship 资源,其中 providerproviders/GOOGLE_ADS。此关系通常通过 Google Ads 界面进行管理。