/api/v4/connected-accounts/connect-listing將商家資訊連結至地點
將特定的 Google Business Profile 或 Facebook 商家資訊連結至 Listings API 地點。
參數
請求主體
| 名稱 | 類型 | 必填 | 說明 |
|---|---|---|---|
| input | object | 必填 | Wrapper object. The entire request body must be nested under `input`. |
| input.locationId | string | 必填 | Base64-encoded location Relay ID (e.g. `TG9jYXRpb246MTgwMDI4OQ==`) of the Listings API location to link the listing to. |
| input.connectedAccountId | string | 必填 | ID of the connected account (Google or Facebook) that owns the listing. Taken from `GET /connected-accounts`. |
| input.connectedAccountListingId | string | 必填 | ID of the listing within that connected account to link. Taken from the `id` of a record returned by `POST /connected-accounts/connected-account-listings`. |
請求範例
可直接貼上的請求主體。請將預留位置 ID 與值換成您自己的。
{ "input": { "locationId": "TG9jYXRpb246MTgwMDI4OQ==", "connectedAccountId": "4f712c17-4f95-42dd-90f4-97171a2e67b5", "connectedAccountListingId": "R29vZ2xlTG9jYXRpb246ODc3NTkzNGItNTA5OC00ZDBhLThiNDQ=" }}回應
200Request accepted. `success` is `true` when the listing was linked; when it cannot be linked `success` is `false` and `message` explains why (for example, `Listing record not found`).
{ "data": { "connectListing": { "message": null, "success": true } }}400Bad request, the body was not wrapped in `input`, or a required field was omitted. Note the field is `connectedAccountListingId`, not `listingId` (the API rejects `listingId` with `did you mean locationId?`).
401Unauthenticated, missing or invalid API key.
將發布平台的商家資訊(Google Business Profile 或 Facebook Page)與 Listings API 地點建立關聯,讓商家資訊資料保持同步。與依建議配對的流程不同,此端點會連結您已選定的單筆商家資訊,無須確認配對。
請求格式。 請求主體必須包在一個 input 物件中,並包含 3 個必填欄位:locationId(以 base64 編碼的地點 Relay ID)、connectedAccountId(擁有該商家資訊的帳戶)及 connectedAccountListingId(要連結的特定商家資訊)。請求中沒有 listingId 欄位,傳送此欄位會被結構描述拒絕。請從 GET /connected-accounts 取得 connectedAccountId,並從 POST /connected-accounts/connected-account-listings 傳回的記錄中的 id 取得 connectedAccountListingId。
使用案例:自動配對結果不明確時手動連結。 附近的 2 間店面名稱相似,trigger-matches 無法判斷哪筆 Google 商家資訊屬於哪個 Listings API 地點。請取得已連結帳戶的商家資訊,讓操作人員選擇正確的商家資訊,再使用此端點直接連結,完全略過建議與確認流程。
如果連結失敗,回應會傳回 success: false,並附上非 null 的 message 來說明原因,例如在無法解析 connectedAccountListingId 時傳回 Listing record not found,或傳回指出該商家資訊已連結至另一個地點的訊息。如果您要改為批次接受系統建議的配對,請使用 confirm-matches 端點。
curl -X POST 'https://listingsapi.com/api/v4/connected-accounts/connect-listing' \ -H "Authorization: API $LISTINGSAPI_KEY" \ -H 'Content-Type: application/json' \ -d '{ "input": { "locationId": "TG9jYXRpb246MTgwMDI4OQ==", "connectedAccountId": "4f712c17-4f95-42dd-90f4-97171a2e67b5", "connectedAccountListingId": "R29vZ2xlTG9jYXRpb246ODc3NTkzNGItNTA5OC00ZDBhLThiNDQ=" } }'