簡體   English   中英

Google 我的商家 API 位置列表請求未返回所有位置

[英]Google My business API locations list request not returning all locations

我正在向 Google 我的商家 API 發出位置列表請求並傳遞給定的帳戶 ID。 list 方法應該返回與給定 id 關聯的所有位置的列表。 可以在此處找到文檔https://developers.google.com/my-business/reference/rest/v4/accounts.locations/list 響應按預期返回位置列表,但是列表中缺少該帳戶可以訪問的某些位置。 我試圖調查是否有任何因素可能導致這種情況,例如驗證狀態、缺少商店代碼、重復的 GMB 位置、誰擁有/管理該位置。 我還沒有發現任何導致問題的因素。 任何人有任何見解?

這個 API 有一個更新版本叫做mybusinessbusinessinformation ,如果你使用編程語言來檢索你列出所有位置就不會有任何問題,例如在 java 中,假設mybusinessNotifMyBusinessNotificationSettings類型的初始化程序,它也負責證書:

String readMask="storeCode,regularHours,name,languageCode,title,phoneNumbers,categories,storefrontAddress,websiteUri,regularHours,specialHours,serviceArea,labels,adWordsLocationExtensions,latlng,openInfo,metadata,profile,relationshipData,moreHours";
                    MyBusinessBusinessInformation.Accounts.Locations.List locationsList = mybusinessaccountLocations.accounts().locations().list(accountName).setReadMask(readMask);
                    ListLocationsResponse Response = locationsList.execute();
                    locations=Response.getLocations();

                    while (Response.getNextPageToken() != null) {
                        locationsList.setPageToken(Response.getNextPageToken());
                        Response=locationsList.execute();
                        locations.addAll(Response.getLocations());              
                    }

事實上,使用getNextPageToken()可以解決您的問題。

我在 Node.js 環境中遇到了類似的問題。

Google 商家資料 Api 方法:accounts.locations.list

雖然文檔中Query Parameters下pageSize默認設置為100,但是如果你在請求的時候沒有定義pageSize,最多可以獲得10個位置。 我能夠通過定義一個可選的 pageSize 來解決我的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM