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.1K members online now
3.1K members online now
For developers who are using the Google My Business API to manage locations
Guide Me
star_border
Reply

400 bad request without details

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

Hi guys!

 

I'm getting 400 error with v3 API each time without details, it happens in OAuth Playground too, even though I've added

X-GOOG-API-FORMAT-VERSION: 2

header to request

 

As I understood from my tests, I have some error in fieldMask parameter, because without it request goes just fine.

Here is my URL: (I can provide real ID's if needed)

https://mybusiness.googleapis.com/v3/accounts/123/locations/1123456?languageCode=de-DE&fieldMask=location.storeCode%2Clocation.address.addressLines%2Clocation.address.country%2Clocation.address.locality%2Clocation.address.postalCode%2Clocation.address.administrativeArea%2Clocation.primaryPhone%2Clocation.primaryCategory%2Clocation.regularHours%2Clocation.photos.profilePhotoUrl%2Clocation.photos.logoPhotoUrl%2Clocation.photos.coverPhotoUrl&validateOnly=true

 

 

So is my fieldMask paramer valid? 

I use php library to send requests.

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Vladimir T
September 2016

Re: 400 bad request without details

Google Employee
# 3
Google Employee

Hi @Vladimir T,

 

You should be able to receive detailed error messages in responses without having to add the additional header when using the OAuth 2.0 Playground to make requests via the Google My Business API. Please note that the fieldMask should no longer include the location. prefix for included fields since v3 of the API.

 

The correct HTTP request with URI and query parameters including the fieldMask for your PATCH request should be:

https://mybusiness.googleapis.com/v3/accounts/account_name/locations/locationId?languageCode=de-DE&fieldMask=storeCode,address.addressLines,address.country,address.locality,address.postalCode,address.administrativeArea,primaryPhone,primaryCategory,regularHours,photos.profilePhotoUrl,photos.logoPhotoUrl,photos.coverPhotoUrl&validateOnly=true

 

Please use the correct languageCode to indicate what localized categories are valid for your update request.

 

Thanks,

Terry

View solution in original post

Re: 400 bad request without details

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭
Ok I figured out while playing around that it might be language code:
```
{
"error": {
"status": "INVALID_ARGUMENT",
"message": "Request contains an invalid argument.",
"code": 400,
"details": [
{
"errorDetails": [
{
"field": "language_code",
"message": "language_code is invalid",
"code": 3,
"value": "en-EN"
}
],
"@type": "type.googleapis.com/google.mybusiness.v3.ValidationError"
}
]
}
}```
Marked as Best Answer.
Solution
Accepted by topic author Vladimir T
September 2016

Re: 400 bad request without details

Google Employee
# 3
Google Employee

Hi @Vladimir T,

 

You should be able to receive detailed error messages in responses without having to add the additional header when using the OAuth 2.0 Playground to make requests via the Google My Business API. Please note that the fieldMask should no longer include the location. prefix for included fields since v3 of the API.

 

The correct HTTP request with URI and query parameters including the fieldMask for your PATCH request should be:

https://mybusiness.googleapis.com/v3/accounts/account_name/locations/locationId?languageCode=de-DE&fieldMask=storeCode,address.addressLines,address.country,address.locality,address.postalCode,address.administrativeArea,primaryPhone,primaryCategory,regularHours,photos.profilePhotoUrl,photos.logoPhotoUrl,photos.coverPhotoUrl&validateOnly=true

 

Please use the correct languageCode to indicate what localized categories are valid for your update request.

 

Thanks,

Terry