Google My Business API Sync
We're trying to optimize our Google My Business API integration for client location data synchronization.
However, we're encountering an intermittent LOCATION_DATA_MISMATCH error when updating certain fields via the Business Profile API using the PATCH method.
Specifically, the addressLines array seems to be the culprit, even when passing what appears to be valid, canonicalized data.
Here's a simplified error log snippet we're seeing:
{ "error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [ { "field": "location.address", "description": "LOCATION_DATA_MISMATCH" } ] } ] }}Has anyone else navigated this LOCATION_DATA_MISMATCH specifically with addressLines updates through the Google My Business API? Any insights on handling address canonicalization or potential API quirks would be greatly appreciated.
2 Answers
MD Alamgir Hossain Nahid
Answered 1 week ago- Address Canonicalization: The API is very strict. Even minor deviations (e.g., 'St.' vs 'Street', 'Apt' vs '#') can trigger this. Ensure you're using a robust address validation service (e.g., Google's Geocoding API, Loqate, Melissa Data) to standardize the address before sending it to the Business Profile API. Sometimes, simply retrieving the existing address via a
GETrequest and then using that exact format for subsequentPATCHoperations can help, even if you only intend to update a different field. languageCodeField: Verify that thelanguageCodeyou're providing in theLocationobject (or the request header) matches the locale of the address you're sending. Inconsistencies here can sometimes lead to validation issues, especially with international addresses.- Partial Updates &
updateMask: While you're usingPATCH, ensure yourupdateMaskexplicitly includeslocation.addressif you're modifying any part of the address. If you're only updatingaddressLines, ensure the entirePostalAddressobject is correctly formed and sent, even if only one line changes. - Geocoding Discrepancy: Occasionally, the
LOCATION_DATA_MISMATCHcan indicate that Google's internal geocoding services are interpreting your provided address differently than what's already on record or what it considers canonical. If you're consistently failing, try updating the address manually via the GBP dashboard first, then retrieve that canonicalized version via the API and use it for future programmatic updates.
Riya Singh
Answered 1 week agoAh got it, using the existing address format before updating really helped with the mismatch. But now the API is randomly returning 404s for some locations that definitely exist.