/api/v4/connected-accounts/create-location-from-listing從已連結帳號的商家資訊建立地點
從已連結帳號中現有的 Google Business Profile 或 Facebook 商家資訊建立新的 Listings API 地點。
參數
請求主體
| 名稱 | 類型 | 必填 | 說明 |
|---|---|---|---|
| input | object | 必填 | Wrapper object. The entire request body must be nested under `input`. |
| 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 to import into a new location. Taken from the `id` of a record returned by `POST /connected-accounts/connected-account-listings`. |
請求範例
可直接貼上的請求主體。請將預留位置 ID 與值換成您自己的。
{ "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.
{ "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 物件中,並包含 2 個必填欄位:connectedAccountId(擁有該商家資訊的帳戶)和 connectedAccountListingId(要匯入的特定商家資訊)。此結構沒有 listingId 欄位,結構描述會拒絕此欄位。
對於 Google 商家資訊,API 會匯入名稱、地址、座標、電話、網站、說明、一般與特殊營業時間、主要與其他類別、開業日期、商店代碼和時區。付款方式和社群個人檔案連結取自該商家資訊的 Google 屬性。除了付款方式和社群連結以外的 Google 屬性也會被讀取,但不會保留。對於 Facebook,則會匯入名稱、地點、營業時間、類別、說明和聯絡資訊。
新地點會自動連結至匯入來源的已連結帳戶。從 Google 匯入時,資料不會重新提交至 Google。匯入來源的商家檔案會維持原狀,其商家資訊會顯示 syncStatus: IN_PROGRESS,直到您的第一個 POST /api/v4/locations/update 將資料發布至該商家資訊為止。其他每個發布平台都會依一般流程處理:系統會產生訂單項目,並將地點提交至帳戶上已啟用的其餘各個網站。
此端點不接受網站範圍設定,也不提供停用提交的選項,因此建立地點時,一律會套用您帳戶的完整發布平台集合。若要將其限制為單一發布平台,請在建立後立即透過 POST /api/v4/locations/update 設定新地點的 enabledSiteIds。請在地點建立完成後立即傳送該更新:其他發布平台的訂單項目會在建立後不久產生,而此更新不會撤回任何已產生的訂單項目。
使用案例:在初始設定期間大量建立地點。 代理商連結了客戶的 Google 帳戶,該帳戶管理 40 間門市,而代理商從未將這些門市輸入 Listings API。您可以列出帳戶中的商家資訊,並針對每個 connectedAccountListingId 呼叫此端點 1 次,建立全部 40 個已預先填入 Google 資料的 Listings API 地點,接著照常計費及管理,無須手動逐一建立地點。
success: true 表示地點已建立,而 locationId 是該地點的資料庫 ID。失敗時,success 為 false,locationId 為 null,而 errors 會包含具結構與代碼的失敗原因,例如在無法根據 connectedAccountListingId 找到對應項目時,會傳回 { "code": "SY81067", "message": "Invalid connected account listing ID" }。其他常見情況包括商家資訊已連結至其他地點,或帳戶憑證已過期,必須透過 connect-google 或 connect-facebook 端點重新連結。若要將商家資訊連結至現有地點,而非建立新地點,請使用 connect-listing 端點。
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==" } }'