迁移账号关联

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

主要区别

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

请求

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

Merchant 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 界面中进行管理。