Google API PHP无法传递变量以调用(' list')

发布于 2025-01-31 18:44:24 字数 568 浏览 3 评论 0原文

我正在尝试使用新的Google Business Profile 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'

据我所知,我似乎正在正确解析该参数。

I am trying to run the following code with the new Google Business Profile 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));
       }

But I am getting the following error:

(list) missing required param: 'parent'

As far as I can tell it seems that I am parsing the param properly.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少女七分熟 2025-02-07 18:44:24

对于正在寻找答案的人:
由于Google更新了API,因此也需要解析清晰度:

 $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/mybusiness/mymybusiness/参考/BusinessInformation/REST/V1/位置

For people that are searching for an answer:
Since Google updated its API, it's a requirement to parse readMask as well:

 $mybusinessbusinessinformationService = new Google\Service\MyBusinessBusinessInformation($client);
$params = array('readMask'=> "title,name");               
$locations = $mybusinessbusinessinformationService->accounts_locations->listAccountsLocations($getAccountName,$params);

var_dump($locations);

You can find the mask parameters here:
https://developers.google.com/my-business/reference/businessinformation/rest/v1/locations

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文