到目前为止,您做了什么:
当我们的网站使用服务帐户查询“列出所有评论” api方法时,异常返回为” Google.GoogleApiException:“针对“父级”的参数验证失败””
有关我们的代码的更多信息:它的asp.net并使用从https://github.com/googleapis/google-api-dotnet-client/issues/1352#issuecomment-475167066生成的“ Google.Apis.MyBusiness.v4” nuget包。我已经从Google仪表板下载了JWT文件,凭证和业务服务对象的构造如下:
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);
以及发生异常的Reviews api调用
var reviewsListRequest = service.Accounts.Locations.Reviews.List("our location name here");
var listReviewsResponse = reviewsListRequest.Execute();
所以问题是什么设置不正确并导致该异常?
答案 0 :(得分:0)
示例:
sub
^^会工作
var reviewsListRequest = service.Accounts.Locations.Get("accounts/accountnumber")
^^将不起作用