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

"address.country: field is read only" for a request not even containing the fields

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

Hi,

 

We're seeing error responses that are:

{
    "error": {
        "code": 400,
        "message": "Request contains an invalid argument.",
        "status": "INVALID_ARGUMENT",
        "details": [
            {
                "@type": "type.googleapis.com/google.mybusiness.v3p1.ValidationError",
                "errorDetails": [
                    {
                        "code": 7,
                        "field": "address.country",
                        "message": "field is read only"
                    }
                ]
            }
        ]
    }
}

And the request body is:

## PATCH location
curl -X "PATCH" "https://mybusiness.googleapis.com/v3/accounts/117524948641077217237/locations/1036281077058933555" \
     -H "Authorization: Bearer REDACTED" \
     -H "Content-Type: application/json; charset=utf-8" \
     -d $'{
  "openInfo": {
    "status": "OPEN"
  },
  "storeCode": "17-ca",
  "locationName": "CenBar"
}'

The request payload doesn't contain the .address field.

 

Any clue what is going on?

1 Expert replyverified_user

"address.country: field is read only" for a request not even containing the fields

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

I was having the same error message, I had to remove the address from the FieldMask

Re: "address.country: field is read only" for a request not even containing the fields

Google Employee
# 3
Google Employee

Hi @Ashesh A,

 

As per the Change Log for the v3 of Google My Business API, fieldMask of location object should no longer include the location. prefix for included fields.

 

Thanks,

The Google My Business API team

"address.country: field is read only" for a request not even containing the fields

Follower ✭ ✭ ☆
# 4
Follower ✭ ✭ ☆

Hi,

 

We are seeing this too.

 

Execute a patch

 

https://mybusiness.googleapis.com/v3/accounts/105240079610799813008/locations/9878876921540064549?la...

or

https://mybusiness.googleapis.com/v3/accounts/105240079610799813008/locations/9878876921540064549?la...

 

with body

 

{"address": {
"locality" :"new locality"
}
}

 

receive.

 

{
 
"error": {
   
"status": "INVALID_ARGUMENT",
   
"message": "Request contains an invalid argument.",
   
"code": 400,
   
"details": [
     
{
       
"errorDetails": [
         
{
           
"field": "address.country",
           
"message": "field is read only",
           
"code": 7
         
}
       
],
       
"@type": "type.googleapis.com/google.mybusiness.v3p1.ValidationError"
     
}
   
]
 
}
}

Re: "address.country: field is read only" for a request not even containing the fi

Google Employee
# 5
Google Employee

Hi @Patrick L,

 

If you are updating only locality of the address object, please make sure you always use fieldMask=address.locality in your request URI and also mention country in your json body to avoid this error. Please checkout the given Request URI and json body for updating the locality via the Google My Business API:

 

PATCH https://mybusiness.googleapis.com/v3/accounts/account_name/locations/locationId?languageCode=en&validateOnly=false&fieldMask=address.locality
      {
      "address": {
                 "country": "country",
                 "locality" :"new locality"
                 }
      }

 

Hope this helps!

 

Thanks,

The Google My Business API team

Re: "address.country: field is read only" for a request not even containing the fi

Follower ✭ ✭ ☆
# 6
Follower ✭ ✭ ☆

Shalini S wrote:

Hi @Patrick L,

 

If you are updating only locality of the address object, please make sure you always use fieldMask=address.locality in your request URI and also mention country in your json body to avoid this error. Please checkout the given Request URI and json body for updating the locality via the Google My Business API:

 

PATCH https://mybusiness.googleapis.com/v3/accounts/account_name/locations/locationId?languageCode=en&validateOnly=false&fieldMask=address.locality
      {
      "address": {
                 "country": "country",
                 "locality" :"new locality"
                 }
      }

 

Hope this helps!

 

Thanks,

The Google My Business API team



Hi @Shalini S,

 

Thanks. Still an issue.

 

https://mybusiness.googleapis.com/v3/accounts/105240079610799813008/locations/9878876921540064549?languageCode=en&fieldMask=address.locality

with this body

 

{
"address": {
"country": "AU",
"locality" :"new locality"
}
}

Receive this error

 

{
 
"error": {
   
"status": "INVALID_ARGUMENT",
   
"message": "Request contains an invalid argument.",
   
"code": 400,
   
"details": [
     
{
       
"errorDetails": [
         
{
           
"field": "address.locality",
           
"message": "Enter an address and marker that specify the same place.",
           
"code": 1103
         
}
       
],
       
"@type": "type.googleapis.com/google.mybusiness.v3p1.ValidationError"
     
}
   
]
 
}
}

 

Passing the different country as is currently there results in

{
  "error": {
    "status": "INVALID_ARGUMENT", 
    "message": "Request contains an invalid argument.", 
    "code": 400, 
    "details": [
      {
        "errorDetails": [
          {
            "field": "address.country", 
            "message": "field is read only", 
            "code": 7, 
            "value": "NZ"
          }
        ], 
        "@type": "type.googleapis.com/google.mybusiness.v3p1.ValidationError"
      }
    ]
  }
}

Re: "address.country: field is read only" for a request not even containing the fi

Google Employee
# 7
Google Employee

Hi @Patrick L,

 

Please make sure, the address you entered is up to date and contains no extraneous information. This error typically happens when the system cannot geocode the specified address, so can you post the full address object of your location which you are trying to update via the Google My Business API?

 

Please note, once a location is created, the country cannot be changed. So we recommended you should not change the country when patching a location via the Google My Business API.

 

Thanks,

The Google My Business API team

"address.country: field is read only" for a request not even containing the fields

Follower ✭ ✭ ☆
# 8
Follower ✭ ✭ ☆

Actually, I think we may have this resolved.

 

It seems a bit strange to pass the country when that is not a value that you are changing but we'll make some adjustments. Will update if still seeing an issue.

 

Thanks

Re: "address.country: field is read only" for a request not even containing the fi

Google Employee
# 9
Google Employee

 

Hi@Patrick L,

 

Glad to know that your issue got resolved. Please feel free to contact us for any Google My Business API related questions.

 

Thanks,

The Google My Business API Team

"address.country: field is read only" for a request not even containing the fields

Visitor ✭ ✭ ✭
# 10
Visitor ✭ ✭ ✭

Hi @Shalini S @Patrick L,

 

I tried to update the Lat & Long values. And get the below error : 

com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"message" : "Request contains an invalid argument.",
"status" : "INVALID_ARGUMENT",
"details" : [ {
"@type" : "type.googleapis.com/google.mybusiness.v3p1.ValidationError",
"errorDetails" : [ {
"code" : 7,
"field" : "latlng",
"message" : "field is read only"
} ]
} ]
}

 

Looks like this field cannot be edited. But what if I need to update the Latitude & Longitude?

Any help is greatly appreciated, Thanks.