POST/api/v4/connected-accounts/create-location-from-listing

从已连接账户的商家信息创建地点

使用已连接账户中现有的 Google Business Profile 或 Facebook 商家信息创建新的 Listings API 地点。

需要 API 密钥。请求头格式和密钥轮换请参阅身份验证。

参数

请求体

名称类型必填描述
inputobject必填Wrapper object. The entire request body must be nested under `input`.
input.connectedAccountIdstring必填ID of the connected account (Google or Facebook) that owns the listing. Taken from `GET /connected-accounts`.
input.connectedAccountListingIdstring必填ID of the listing to import into a new location. Taken from the `id` of a record returned by `POST /connected-accounts/connected-account-listings`.

请求示例

可直接粘贴的请求体。请将占位 ID 和值替换为您自己的。

Request body
{  "input": {    "connectedAccountId": "4f712c17-4f95-42dd-90f4-97171a2e67b5",    "connectedAccountListingId": "R21iQnVsa0RhdGFMYWtlOjU3NzU5MzRiLTUwOTgtNGQwYS04YjQ0LTNjY2ZlZmZkZmUzNw=="  }}

响应

200Request accepted. `success` is `true` and `locationId` holds the new location's database ID; on failure `success` is `false`, `locationId` is `null`, and `errors` carries a structured, coded reason.
Response
{  "data": {    "createLocationFromConnectedAccountListing": {      "success": true,      "locationId": 88277,      "errors": null    }  }}
400Bad request, the body was not wrapped in `input`, or a required field was omitted. The field is `connectedAccountListingId`, not `listingId` (the latter is rejected by the schema).
401Unauthenticated, missing or invalid API key.

从已连接的 Google Business Profile 或 Facebook 账户中的现有商家信息获取业务数据,以创建新的 Listings API 地点。该商家信息必须已存在于该账户中(通过 POST /connected-accounts/connected-account-listings 获取),且尚未关联到其他 Listings API 地点。

请求结构。请求体必须封装在一个 input 对象中,该对象包含两个必填字段:connectedAccountId(商家信息所属的账户)和 connectedAccountListingId(要导入的具体商家信息)。请求体中没有 listingId 字段,schema 会拒绝该字段。

对于 Google 商家信息,API 会导入名称、地址、坐标、电话号码、网站、描述、常规营业时间和特殊营业时间、主要类别和附加类别、开业日期、门店代码及时区。付款方式和社交资料链接来自该商家信息的 Google 属性。除付款方式和社交链接之外的 Google 属性也会被读取,但不会保留。对于 Facebook,API 会导入名称、地点、营业时间、类别、描述和联系信息。

新地点会自动关联到导入来源的已连接账户。从 Google 导入时,数据不会重新提交到 Google。您导入的源资料保持原样,其商家信息报告的状态为 syncStatus: IN_PROGRESS,直到您首次通过 POST /api/v4/locations/update 向其发布内容。所有其他发布平台均按正常流程处理:系统会生成订单项,并将该地点提交到该账户已启用的其余各个站点。

此端点不接受站点范围,也不提供禁用提交的选项,因此创建地点时始终会使用您账户中的全部发布平台。要将其限制为单个发布平台,请在创建后立即通过 POST /api/v4/locations/update 设置新地点的 enabledSiteIds。请在地点创建完成后立即发送该更新:其他发布平台的订单项会在创建后不久生成,而此更新不会撤回任何已生成的订单项。

使用场景:在初始设置过程中批量创建地点。一家代理机构连接了客户的 Google 账户,该账户管理着 40 家门店,代理机构此前从未将这些门店录入 Listings API。无需手动创建每个地点,只需列出该账户的商家信息,并针对每个 connectedAccountListingId 调用一次此端点,即可创建全部 40 个 Listings API 地点,并使用 Google 数据预填充,然后按正常流程计费和管理。

success: true 表示地点已创建,locationId 是该地点的数据库 ID。失败时,success 为 false,locationId 为 null,errors 包含带有代码的结构化失败原因,例如,当无法解析 connectedAccountListingId 时,原因为 { "code": "SY81067", "message": "Invalid connected account listing ID" }。其他常见情况包括商家信息已关联到其他地点,或账户凭据已过期,必须通过 connect-google 或 connect-facebook 端点重新连接。要将商家信息关联到现有地点而不创建新地点,请使用 connect-listing 端点。

Request
curl -X POST 'https://listingsapi.com/api/v4/connected-accounts/create-location-from-listing' \  -H "Authorization: API $LISTINGSAPI_KEY" \  -H 'Content-Type: application/json' \  -d '{    "input": {      "connectedAccountId": "4f712c17-4f95-42dd-90f4-97171a2e67b5",      "connectedAccountListingId": "R21iQnVsa0RhdGFMYWtlOjU3NzU5MzRiLTUwOTgtNGQwYS04YjQ0LTNjY2ZlZmZkZmUzNw=="    }  }'