My Business
1.6K members online now
1.6K members online now
For developers who are using the Google My Business API to manage locations
Guide Me
star_border
Reply

Unable to see Locations in GMB UI which are created using GMB API service account

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 

We are able to create and retrieve locations using GMB API service account but unable to find those locations in GMB UI for same account. The GMB account shows 800+ locations in GMB UI but when I retrieve from GMB API I could see only those locations which I created using service account but not the existing. What could be wrong with this? Please advise how can I be able to get & update existing locations using GMB API. FYI Service Account which I'm using to make API call is added as manager to the GMB Account. 

 

I have created following 3 locations for account I am using:

accounts/102380668342449972277/locations/14483181412551140501
accounts/102380668342449972277/locations/2402545903830159478
accounts/102380668342449972277/locations/15830841680877134481

 

Appreciate any help on this.

 

Thanks,

Deependra

 

 

1 Expert replyverified_user

Re: Unable to see Locations in GMB UI which are created using GMB API service account

[ Edited ]
Google Employee
# 2
Google Employee

Hi @Deependra P,

 

A service account's generated email address is not equivalent to a Google Account’s email address. You can't sign in with your service account's email address to access the Google My Business UI. Therefore, the locations you created in your service account are not accessible via the UI and can’t be verified. You also can’t add a service account's email address as an admin to a business account or location because when you invite someone to become an admin for an account or location, the invitee's email address should be associated with a Google Account in order to accept the invitation and become an admin.

 

For using a service account to access the Google My Business account and location data on behalf of a particular end user, you should request user consent for that end user’s Google Account only once. You can perform this process during the OAuth 2.0 installed application flow or using OAuth 2.0 Playground. When you prepare to make authorized API calls using the service account, you specify the user to impersonate by specifying the email address of the user’s Google Account for access to their Google My Business data.

 

I don’t know your programming language preference, but for your reference, this is the Accepted Solution for using a service account with the Google API Client Library for PHP.

 

I hope this helps.

 

Thanks,

Terry

Re: Unable to see Locations in GMB UI which are created using GMB API service account

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Thanks Terry for your response.

After adding User = Google Account of GMB Manager I was able to get the locations from GMB account.

I have another query regarding the Accounts.Locations.Get method. I have locations name only and I want to validate if those locations exists in GMB before creating them else it would create duplicate locations. Name parameter for Accounts.Locations.Get method accepts locations as "accounts/{account_id}/locations/{location_id}" format whereas I just have location names only. Could you please advise what's the best way to check if location exists or not when I have Location name only and not the location ID?

Thanks,
Deependra


Re: Unable to see Locations in GMB UI which are created using GMB API service account

[ Edited ]
Google Employee
# 4
Google Employee

Hi @Deependra P,

 

When you send a POST request to create a new location under the specified account, you are required to provide a requestId (UUIDs are recommended) that’s unique for each location; it helps prevent duplicate locations from being created in your account. Attempts to create a location when the requestId matches that of a previously created location simply returns the existing location, and avoids creating a duplicate in your account.

 

If you keep track of the requestId for each location you create, you should be able to prevent creating any duplicate locations. Multiple locations with unique name fields which are Google identifiers for each location, and the same locationName field which is the business's real-world name, is commonplace for a chain business. Therefore, you should use a unique value for the storeCode field of each Location object you create per account to distinguish these locations for your own records. When you create a new location, you should check if a location already exists in your account by checking the requestId, locationName and storeCode fields of the previously created locations and make sure that the location you are creating is distinct.

 

For more information about understanding your duplicate locations listing status and on how to resolve the situation, please check out this article in the Google My Business Help Center.

 

Thanks,

Terry