andrew
andrew

Reputation: 1260

Google My Business API: issue obtaining Reviews

What's been done so far:

When our website uses the Service Account to interrogate the "List all reviews" api method, the exception back is "Google.GoogleApiException: 'Parameter validation failed for "parent"'"

A bit more about our code: Its asp.net and using a "Google.Apis.MyBusiness.v4" nuget package generated from https://github.com/googleapis/google-api-dotnet-client/issues/1352#issuecomment-475167066. I have downloaded the JWT file from the google dashboard, and the credential and business service objects are constructed as follows:

var scopes = new List<string>()
  {
   "https://www.googleapis.com/auth/plus.business.manage",
  };

  var stream = new FileStream("key.json", FileMode.Open, FileAccess.Read);
  var credential = GoogleCredential.FromStream(stream);
  credential = credential.CreateScoped(scopes);

  var initializer = new BaseClientService.Initializer()
  {
   HttpClientInitializer = credential,
   ApplicationName = "Google Reviews",
  };
  var service = new MyBusinessService(initializer);

And the Reviews api call where the exception happens

  var reviewsListRequest = service.Accounts.Locations.Reviews.List("our location name here");
  var listReviewsResponse = reviewsListRequest.Execute();

So the question is what isn't set up correctly and causing that exception?

Upvotes: 2

Views: 1845

Answers (1)

Seemingepic
Seemingepic

Reputation: 77

Example:

var reviewsListRequest = service.Accounts.Locations.Get("accounts/accountnumber")

^^ WILL WORK

var reviewsListRequest = service.Accounts.Locations.Get("accountnumber");

^^ WILL NOT WORK

Upvotes: 4

Related Questions