【发布时间】:2019-09-24 12:57:16
【问题描述】:
我们有一个管理多个地点的“Google 我的商家”帐户。我想创建一个回答问题的界面。我的问题是我找不到如何检索当前位置的 Author 对象。
我尝试创建一个新的 Google_Service_MyBusiness_Author 对象并提交它,但它似乎不起作用。我正在使用 MyBusiness API 4.5
$author = new Google_Service_MyBusiness_Author();
$author->setDisplayName('location display name');
$author->setProfilePhotoUrl('someurl.jpg');
$author->setType('MERCHANT');
$answer = new Google_Service_MyBusiness_Answer();
$answer->setText($_POST['answerReplyText']);
$answer->setAuthor($author);
$postBody = new Google_Service_MyBusiness_UpsertAnswerRequest();
$postBody->setAnswer($answer);
try {
$mybusinessService->accounts_locations_questions_answers->upsert($_POST['question_name'],$postBody);
}
catch(Exception $e) {
var_dump($e);
}
我收到“请求包含无效参数”异常。我这样做对吗?我应该怎么做才能使我的答案有效?
【问题讨论】:
-
我刚刚遇到了完全相同的问题,这曾经可以工作,但现在我只得到“无效参数”-异常。
-
顺便说一句,答案的“作者”字段是“仅输出”,因此无需设置。
-
我刚收到gmb api支持的答复,他们目前正在调查api中的一个问题。我向他们报告了这个问题,因为 api 请求不仅通过 php-sdk 失败,而且通过他们自己的 oauth2 游乐场失败。
标签: php google-my-business-api