AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

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

location validation errors

[ Edited ]
Follower ✭ ✭ ☆
# 1
Follower ✭ ✭ ☆

Hi,

We're posting the following request body to the location patch endpoint;

{
  "storeCode" : "barnini-antwerpen-2",
  "locationName" : "Barnini",
  "primaryPhone" : "+32 3 485 82 69",
  "additionalPhones" : null,
  "address" : {
    "addressLines" : [ "Oude Vaartplaats 10" ],
    "subLocality" : null,
    "locality" : "Antwerpen",
    "administrativeArea" : "Vlaanderen",
    "country" : "BE",
    "postalCode" : "2000"
  },
  "primaryCategory" : {
    "categoryId" : "gcid:restaurant"
  },
  "additionalCategories" : [ {
    "categoryId" : "gcid:bagel_shop"
  }, {
    "categoryId" : "gcid:sandwich_shop"
  } ],
  "websiteUrl" : "http://barnini.be",
  "regularHours" : {
    "periods" : [ {
      "openDay" : "MONDAY",
      "openTime" : "08:00",
      "closeDay" : "MONDAY",
      "closeTime" : "19:00"
    }, {
      "openDay" : "TUESDAY",
      "openTime" : "08:00",
      "closeDay" : "TUESDAY",
      "closeTime" : "19:00"
    }, {
      "openDay" : "WEDNESDAY",
      "openTime" : "08:00",
      "closeDay" : "WEDNESDAY",
      "closeTime" : "19:00"
    }, {
      "openDay" : "THURSDAY",
      "openTime" : "08:00",
      "closeDay" : "THURSDAY",
      "closeTime" : "19:00"
    }, {
      "openDay" : "FRIDAY",
      "openTime" : "08:00",
      "closeDay" : "FRIDAY",
      "closeTime" : "19:00"
    }, {
      "openDay" : "SATURDAY",
      "openTime" : "08:00",
      "closeDay" : "SATURDAY",
      "closeTime" : "19:00"
    }, {
      "openDay" : "SUNDAY",
      "openTime" : "08:00",
      "closeDay" : "SUNDAY",
      "closeTime" : "17:00"
    } ]
  },
  "specialHours" : null,
  "serviceArea" : null,
  "locationKey" : null,
  "labels" : null,
  "adWordsLocationExtensions" : null,
  "photos" : {
    "coverPhotoUrl" : "https://cdn0.centralapp.com/api/v1/media/cover-16-9/3337_1460637086721_vjLDjDHyQw_cover.jpeg",
    "profilePhotoUrl" : "https://cdn0.centralapp.com/api/v1/media/logo-large/3337_1460637053223_vjLDjDHyQw_logo.jpeg",
    "logoPhotoUrl" : "https://cdn0.centralapp.com/api/v1/media/logo-large/3337_1460637053223_vjLDjDHyQw_logo.jpeg",
    "preferredPhoto" : "PROFILE",
    "additionalPhotoUrls" : [ "https://cdn0.centralapp.com/api/v1/media/gallery-large/3337_1460637097175_vjLDjDHyQw_gallery.jpeg", "https://cdn0.centralapp.com/api/v1/media/gallery-large/3337_1460637111519_vjLDjDHyQw_gallery.jpeg", "https://cdn0.centralapp.com/api/v1/media/gallery-large/3337_1460637141937_vjLDjDHyQw_gallery.jpeg", "https://cdn0.centralapp.com/api/v1/media/gallery-large/3337_1460637150611_vjLDjDHyQw_gallery.jpeg", "https://cdn0.centralapp.com/api/v1/media/gallery-large/3337_1460637186803_vjLDjDHyQw_gallery.jpeg", "https://cdn0.centralapp.com/api/v1/media/gallery-large/3337_1460970458102_vjLDjDHyQw_gallery.jpeg", "https://cdn0.centralapp.com/api/v1/media/gallery-large/3337_1460970473240_vjLDjDHyQw_gallery.jpeg", "https://cdn0.centralapp.com/api/v1/media/gallery-large/3337_1460970488117_vjLDjDHyQw_gallery.jpeg", "https://cdn0.centralapp.com/api/v1/media/gallery-large/3337_1460970559823_vjLDjDHyQw_gallery.jpeg", "https://cdn0.centralapp.com/api/v1/media/gallery-large/3337_1460970590763_vjLDjDHyQw_gallery.jpeg" ]
  },
  "openInfo" : {
    "status" : "OPEN"
  }
}

The address posted in this request is valid and exists on google maps.

However, the API rejects this request with the following error;

{
    "error" : {
      "code" : 400,
      "message" : "Request contains an invalid argument.",
      "status" : "INVALID_ARGUMENT",
      "details" : [ {
        "@type" : "type.googleapis.com/google.mybusiness.v3.ValidationError",
        "errorDetails" : [ {
          "code" : 1100,
          "field" : "address.country",
          "message" : "The specified address cannot be located."
        } ]
      } ]
    }
  }

Which, in this case, seems like erroneous. 

What should we do in this case?

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Ashesh A
January 2017

Re: location validation errors

Google Employee
# 2
Google Employee

Hi @Ashesh A,

 

I replaced the addressLines field of the Address object in your PATCH request to “Oudevaartplaats 10” as shown exactly on Maps and the PATCH request passed system validation and updated the location successfully.

 

If you are certain that the address you entered is up to date and contains no extraneous information, and you are still getting the 400 Bad Request error with the message "The specified address cannot be located." that typically happens when the system cannot geocode the specified address, you can provide the correct latitude/longitude values in a LatLng object when creating a new location via the API to fix this error. Please note that the latlng field is read-only and cannot be updated once the location is created.

 

If you have already created the location and you are sending a PATCH request to update the location via the API, please use a fieldMask and confirm that the fieldMask does not include address and latlng. You can fix this geocode error by dropping a pin for your business location through the Google My Business UI.

 

Thanks,

Terry

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Ashesh A
January 2017

Re: location validation errors

Google Employee
# 2
Google Employee

Hi @Ashesh A,

 

I replaced the addressLines field of the Address object in your PATCH request to “Oudevaartplaats 10” as shown exactly on Maps and the PATCH request passed system validation and updated the location successfully.

 

If you are certain that the address you entered is up to date and contains no extraneous information, and you are still getting the 400 Bad Request error with the message "The specified address cannot be located." that typically happens when the system cannot geocode the specified address, you can provide the correct latitude/longitude values in a LatLng object when creating a new location via the API to fix this error. Please note that the latlng field is read-only and cannot be updated once the location is created.

 

If you have already created the location and you are sending a PATCH request to update the location via the API, please use a fieldMask and confirm that the fieldMask does not include address and latlng. You can fix this geocode error by dropping a pin for your business location through the Google My Business UI.

 

Thanks,

Terry