POST/api/v4/locations/create/gmb-listing

为地点创建 GMB 商家信息

为现有的 Listings API 地点创建新的 Google Business Profile 商家信息,并将其关联到已连接的 Google 账号。

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

参数

请求体

名称类型必填描述
inputobject必填Wrapper object. The entire request body must be nested under `input`.
input.locationIdstring必填Base64-encoded location Relay ID (e.g. `TG9jYXRpb246MTgwMDI4OQ==`) of the location to create the Google listing for.
input.connectedAccountIdstring必填UUID of the connected Google account the new listing should be created under. Taken from `GET /connected-accounts`.
input.folderIdstring可选Google account group to create the listing inside, as the `accounts/{id}` string from the folders endpoint. Omit to create it at the account root.

请求示例

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

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

响应

200Request accepted. `success: true` means GMB listing creation was initiated.
Response
{  "data": {    "createGmbListingForLocation": {      "clientMutationId": null,      "success": true,      "errors": null    }  }}
400Bad request, the body was not wrapped in `input` (error message: `Variable "$input" of required type "CreateGmbListingForLocationInput!" was not provided`).
401Unauthenticated, missing or invalid API key.

为 Listings API 地点创建全新的 Google Business Profile 商家信息,并将其关联到已连接的 Google 账号。当地点尚无任何 Google 商家信息时,请使用此操作;而 connect-listing 用于将 Listings API 地点关联到 Google 账号中已存在的商家信息。

请求结构。请求体必须封装在一个 input 对象中,并包含两个必填字段:locationId(经 base64 编码的地点 Relay ID)和 connectedAccountId(用于创建商家信息的 Google 账号)。folderId 为可选字段;如需将新商家信息放入特定的 Google 账号组,请传入此字段,其值应从列出文件夹中原样获取。发送未封装的扁平请求体会被拒绝,并返回 HTTP 400。

创建过程是异步的:success: true 表示请求已被接受,并不意味着商家信息已立即上线。Google 会在发布前审核新的商家资料。

使用场景:为全新门店建立 Google 商家信息。客户新开了一个地点,该地点尚无 Google Business Profile。请先创建 Listings API 地点,连接客户的 Google 账号,然后使用该地点的 ID 和 connectedAccountId 调用此端点,让 Listings API 在该账号下向 Google 提交新的商家信息。随后轮询该地点的商家信息,观察其状态从待处理变为已验证。

创建商家信息之前,地点必须已包含有效的商家信息(名称、地址、电话),且每个地点只能有一条 Google 商家信息。失败时,errors 会说明原因,通常是地点缺少必填字段、已有 Google 商家信息、已归档,或已连接账户未处于活跃状态。已失效的账户请通过 connect-google 端点重新连接。请注意,即使 connectedAccountId 并非真实且已连接的 Google 账号,此端点目前仍会返回 success: true,因此请通过该地点的商家信息确认新商家信息确实已出现,而不要仅依赖 success。

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