Reputation: 121
I am making a locations list request to the Google My Business API and passing a given account id. The list method is supposed to return a list of all locations associated to the given id. The documentation can be found here https://developers.google.com/my-business/reference/rest/v4/accounts.locations/list. The response is returning a list of locations as expected however there are some locations that the account has access to that are missing from the list. I have tried to investigate to see if there are any factors that could be causing this such as verification status, missing store code, duplicate GMB location, who owns/manages the location. I have not found any factor that is the cause of the issue. Anyone have any insight?
Upvotes: 2
Views: 4584
Reputation: 324
Assuming you handled the pagination correctly (as others noted default number of location returned per request is 10 with maximum been 100), I would recommend you:
Check in GMB that location is listed under the account/location group - if it is not there you won't get it through API since you don't manage/own it. As long as you manage/own it you should be able to list it despite its status.
If it is listed but you still are not getting it - write ticket to Google support at https://support.google.com/business/contact/api_default and they should fix the issue (happened 2-3 times to me)
Upvotes: 0
Reputation: 1
I was facing a similar issue in Node.js environment.
Google Business Profile Api Method: accounts.locations.list
Although pageSize is set as 100 by default under Query Parameters in the documentation, if you do not define pageSize when requesting, you can get up to 10 locations. I was able to solve my problem by defining an optional pageSize.
Upvotes: 0
Reputation: 1077
There is a newer version of this API called mybusinessbusinessinformation
, if you use a programming language to retrieve you would not have any problem to list all your locations, for example in java, suppose that mybusinessNotif
is an initializer of type MyBusinessNotificationSettings
which also takes care of credentials:
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());
}
In fact using getNextPageToken()
takes care of your problem.
Upvotes: 0
Reputation: 1613
The maximum page size is 100 [1][2]. Are you expecting more than 100 from a single request?
[1] https://developers.google.com/my-business/reference/rest/v4/accounts.locations/list
[2] https://developers.google.com/my-business/reference/businessinformation/rest/v1/accounts.locations/list
Upvotes: 0