GET
/api/v4/locations-by-store-codes依門市代碼取得地點
傳回依門市代碼識別的 1 個或多個地點的完整詳細資料。
參數
查詢
| 名稱 | 類型 | 必填 | 說明 | 預設值 |
|---|---|---|---|---|
| storeCodes | string | 必填 | JSON-encoded array of store code strings, e.g. `["ACME01","jio678"]`. URL-encode the value. | — |
回應
200Array of full location objects matching the provided store codes. Returns `null` when no store codes match.
{ "data": { "getLocationsByStoreCodes": [ { "id": "TG9jYXRpb246MTgwMDI4OQ==", "databaseId": 1800289, "accountId": 12345, "storeId": "ACME01", "name": "Jenny Home", "archived": false, "street": "600 Congress Ave, Suite 200", "city": "Austin", "stateIso": "TX", "postalCode": "78701", "countryIso": "US", "phone": "5125550142", "categoryId": 15, "subCategoryId": 1432, "subCategoryName": "Restaurants", "package": "PREMIUM", "planId": 3797, "planName": "Launch", "placeActionLinks": [ { "placeActionType": "FOOD_ORDERING", "uri": "https://order.example.com", "isPreferred": true, "name": "locations/1944.../placeActionLinks/54ada85bc246058a", "submissionStatus": "success" } ], "discoveredPlaceActionLinks": [] } ] }}401Unauthenticated, missing or invalid API key.
429Rate limit exceeded. Retry after the `Retry-After` header value.
將門市代碼解析為完整的地點記錄:這與透過 Listings API 的內部 ID 追蹤地點的方式相反。當您自己的系統(POS、加盟店名冊、PIM)以門市代碼作為地點的索引鍵,且您需要擷取或核對相符的 Listings API 地點時,請使用此端點。請將代碼編碼為 JSON 陣列並做 URL 編碼,再透過 storeCodes 查詢參數傳入。
使用案例:核對加盟店名冊。 使用您主清單中的門市代碼呼叫 ?storeCodes=["ACME01","ACME02","ACME03"],並將每個傳回物件的 storeId 與您的記錄比對,以確認哪些門市已加入 Listings API。找不到相符地點的代碼不會出現在傳回的陣列中。
注意事項:空值與缺少資料的差異。 當提供的所有代碼都無法與帳戶中的地點相符時,getLocationsByStoreCodes 會是 null(而非空陣列),因此請先檢查是否為 null,再逐一處理結果。只有在建立時或透過更新設定了 storeId,地點才會有門市代碼;沒有門市代碼的地點只能透過 ID 擷取。請將多個代碼合併至單次呼叫中,以免超過速率限制,並在收到 429 時遵循 Retry-After 標頭。
每個地點都會傳回 placeActionLinks(Listings API 管理的 Google 動作連結)和 discoveredPlaceActionLinks(直接在商家的 Google 商家檔案中找到,但尚未納入管理的連結)。請參閱地點動作連結指南。
Request
curl -X GET 'https://listingsapi.com/api/v4/locations-by-store-codes?storeCodes=<storeCodes>' \ -H "Authorization: API $LISTINGSAPI_KEY"