【发布时间】:2018-06-19 00:45:50
【问题描述】:
三天我很沮丧,因为谷歌没有 php 教程。 (对不起我的英语不好)
更新名称时出错:
$client=client_google();
$google_id="people/c3062123412341234";
if ($client->getAccessToken() == "") return null;
$people_service = new Google_Service_PeopleService($client);
$person = new Google_Service_PeopleService_Person();
if($tipenya == "Cancel"){
$name = new Google_Service_PeopleService_Name();
$name->SetFamilyName("Keluarga Cemara");
$name->SetGivenName("Tampan");
$person->setNames($name);
$profile = $people_service->people->get(
$google_id,
array('personFields' => 'metadata'));
$etag = $profile->etag;
$person->setEtag($etag);
$person->setResourceName($google_id);
if($google_id !=''){
//$people_service->people->updatePersonField("names");
$people_service->people->updateContact($google_id,$person);
}
}else if($tipenya=="Delete"){
if($google_id !=''){
$person->setResourceName($google_id);
$people_service->people->deleteContact($person);
}
}
执行时出错:
异常“Google_Service_Exception”带有消息“{ “错误”: { “代码”:400, "message": "updatePersonFields 掩码是必需的。请指定一个或多个有效路径。有效路径记录在https://developers.google.com/people/api/rest/v1/people/update。", “错误”:[ { "message": "updatePersonFields 掩码是必需的。请指定一个或多个有效路径。有效路径记录在https://developers.google.com/people/api/rest/v1/people/update。", “域”:“全球”, “原因”:“错误请求” } ], “状态”:“INVALID_ARGUMENT”}}'
【问题讨论】:
-
您是否尝试在 Google 论坛中提问?我认为这是收集 Google 产品相关信息的最佳场所。
-
错误消息中的链接无效。试试这个:developers.google.com/people/api/rest/v1/people/updateContact
标签: php google-api google-people-api