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 物件中,並包含 2 個必填欄位: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。之後請輪詢該地點的商家資訊,觀察其狀態從待處理變為已驗證。

建立商家資訊前,地點必須已具備有效的商家資料(名稱、地址、電話),且每個地點只能有 1 筆 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"    }  }'