Google API PHP 无法将变量传递给 call('list')



我正在尝试使用新的Google Business Profile API运行以下代码:

$mybusinessbusinessinformationService = new GoogleServiceMyBusinessBusinessInformation($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 GoogleServiceMyBusinessBusinessInformation($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

最新更新