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

Google.Apis.Requests.RequestError Invalid JSON payload received. Unknown name "location" @ 'location

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

Hi All,

I'm receiving the following error when attempting to create a location:

 

Google.Apis.Requests.RequestError

Invalid JSON payload received. Unknown name "location" at 'location': Cannot find field.

Invalid JSON payload received. Unknown name "request_id" at 'location': Cannot find field.

Invalid JSON payload received. Unknown name "validate_only" at 'location': Cannot find field. [400]

Errors [

Message[Invalid JSON payload received. Unknown name "location" at 'location': Cannot find field.

Invalid JSON payload received. Unknown name "request_id" at 'location': Cannot find field.

Invalid JSON payload received. Unknown name "validate_only" at 'location': Cannot find field.] Location[ - ] Reason[badRequest] Domain[global]

 

Here's the code that is executing the request:

////Create a test location
CreateLocationRequest locationRequest = new CreateLocationRequest();
Location locData = new Location();
Address addrDetails = new Address();
Category catDetails = new Category();
IList<string> aLines = new List<string>();
addrDetails.Country = "NL";
addrDetails.AdministrativeArea = "Amsterdam";
addrDetails.Locality = "Amsterdam";
addrDetails.PostalCode = "1075 HM";

aLines.Add("Valeriusstraat 180");
addrDetails.AddressLines = aLines;
catDetails.Name = "Internet Marketing Service";

 

locData.LocationName = "My Test";
locData.WebsiteUrl = "http://www.test.com";
locData.Address = addrDetails;
locData.PrimaryCategory = catDetails;

 

locationRequest.Location = locData;
locationRequest.LanguageCode = "en";
locationRequest.RequestId = Guid.NewGuid().ToString();
locationRequest.ValidateOnly = false;


try
{
Location newDetails =
gmbService.Accounts.Locations.Create(locationRequest, gmbName).Execute();

if (newDetails != null)
{

}
}

catch (Exception ex)
{
Logging.GmbLog.Error(ex, "Locations.Create");
throw;
}

 

I've looked through the community, but haven't been able to find anything that is quite the same as what I'm experiencing. Can anyone point out anything here that may be incorrect in the code to throw this error? I'm using C#. If more code or other information is needed, please let me know. Any help would be greatly appreciated.

 

Thanks!

1 Expert replyverified_user

Re: Google.Apis.Requests.RequestError Invalid JSON payload received. Unknown name "location&quo

Google Employee
# 2
Google Employee

Hi @Staci K,

 

Since the C# client library doesn’t currently support the display of detailed error messages, so I suggest you follow the Make a simple HTTP request step-by-step guide on the Google Developers site and try use the OAuth 2.0 Playground to step through the auth flow, and examine the HTTP request/response at each step. This usually helps pinpoint where an application is passing the incorrect info.

 

Thanks,

Shalini, Google My Business API team

Google.Apis.Requests.RequestError Invalid JSON payload received. Unknown name &quot;location&quot; @ 'location

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi Shalini,

 

Thank you for your response. I've attempted to use the OAuth 2.0 Playground, but when I try to make a request using https://mybusiness.googleapis.com/v3/accounts, I get an error saying that the Google My Business api isn't enabled. However, it is indeed enabled on my console. Any suggestions on what may be a solution to this?

 

Thanks,

Staci

Re: Google.Apis.Requests.RequestError Invalid JSON payload received. Unknown name &quot;location

Google Employee
# 4
Google Employee

Hi @Staci K,

 

The common cause for not being able to find the Google My Business API in Google Developers Console is your Google Account may not have been submitted in the access request form as an email address that will administer the Project ID.

 

We’ll reach out to you privately on a separate thread for more details.

 

Thanks,

Shalini, Google My Business API team