Google Api PHP 无法将变量传递给调用 ('list')
Google Api PHP unable to pass variable to call('list')
我正在尝试 运行 使用新的 Google 业务资料 API 以下代码:
$mybusinessbusinessinformationService = new Google\Service\MyBusinessBusinessInformation($client);
try
{
$locations = $mybusinessbusinessinformationService->accounts_locations->call('list',['parent'=>'accounts/1111111111111111111']);
var_dump($locations);
} catch(Exception $e){
var_dump(print_r($e->getMessage(),1));
}
但我收到以下错误:
(list) missing required param: 'parent'
据我所知,我似乎正在正确解析参数。
对于正在寻找答案的人:
由于 Google 更新了它的 API,因此也需要解析 readMask:
$mybusinessbusinessinformationService = new Google\Service\MyBusinessBusinessInformation($client);
$params = array('readMask'=> "title,name");
$locations = $mybusinessbusinessinformationService->accounts_locations->listAccountsLocations($getAccountName,$params);
var_dump($locations);
您可以在此处找到遮罩参数:
https://developers.google.com/my-business/reference/businessinformation/rest/v1/locations
我正在尝试 运行 使用新的 Google 业务资料 API 以下代码:
$mybusinessbusinessinformationService = new Google\Service\MyBusinessBusinessInformation($client);
try
{
$locations = $mybusinessbusinessinformationService->accounts_locations->call('list',['parent'=>'accounts/1111111111111111111']);
var_dump($locations);
} catch(Exception $e){
var_dump(print_r($e->getMessage(),1));
}
但我收到以下错误:
(list) missing required param: 'parent'
据我所知,我似乎正在正确解析参数。
对于正在寻找答案的人: 由于 Google 更新了它的 API,因此也需要解析 readMask:
$mybusinessbusinessinformationService = new Google\Service\MyBusinessBusinessInformation($client);
$params = array('readMask'=> "title,name");
$locations = $mybusinessbusinessinformationService->accounts_locations->listAccountsLocations($getAccountName,$params);
var_dump($locations);
您可以在此处找到遮罩参数: https://developers.google.com/my-business/reference/businessinformation/rest/v1/locations