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

Looking for best practices for preventing duplicates on creation wiht GMB API

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

I am looking for best practices for preventing the creation of duplicates.  

Currently if I have a new location, I need to get the list of location to make this location does not already exist in the account.  

The if it does not exist I create the location.  

Updates for this location can not be made until creation has  been completed and I have the account/*/location/*(name)

Is there another way or quicker way I can check for duplicates, without querying the list of locations?

 

Thank you

1 Expert replyverified_user

Re: Looking for best practices for preventing duplicates on creation wiht GMB API

[ Edited ]
Google Employee
# 2
Google Employee

Hi @Rio S,

 

It’s best practice to supply a unique request ID (UUIDs are recommended) for the server to detect duplicated requests when you are creating a new location via the Google My Business API. It helps prevent duplicate locations from being created in your account. Any attempt to create a location where the request ID matches 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 every location you create at your end, you should be able to prevent creating any duplicate locations. Please note that the requestId field in the LocationKey object returned from GET requests may be empty if the location was created outside of the Google My Business API or Google My Business 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 every Location object you create inside a given account to distinguish these locations when associating them with your own records. When you create a new location, you should check at your end if a location already exists in your account by checking the requestId, locationName and storeCode fields (more Location fields if necessary) of the previously created locations and make sure that the location you are creating is distinct.

 

However, when detecting duplicate locations via the Google My Business API, you best bet still is to send a GET request to filter results with the location_state.is_duplicate restriction when listing locations. Please note that you should also check for the PlaceID of a verified location because the placeId is unique for every verified location.

 

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

 

Thanks,

Terry

Looking for best practices for preventing duplicates on creation wiht GMB API

[ Edited ]
Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thanks Terry,

 

  1. If the ID's are the same but location data has been changed will it update the location during a create?
  2. Does the duplicate create contain the LocationState::isDuplicate?

Thanks Again

 

 

Marked as Best Answer.
Solution
Accepted by topic author Rio S
November 2016

Re: Looking for best practices for preventing duplicates on creation wiht GMB API

Google Employee
# 4
Google Employee

Hi @Rio S,

 

1. No, if the requestId is the same as the one used in a previously created location, the POST request for creating a new location under the specified account returns the existing location, similar to the GET request for retrieving the specified location.

 

2. Yes, the isDuplicate boolean field of the LocationState object should indicate whether the location is a duplicate of another location in different scenarios according to metadata.duplicate.

 

Thanks,

Terry