首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Google API -使用Google_Service_MyBusinessBusinessInformation获取位置

Google API -使用Google_Service_MyBusinessBusinessInformation获取位置
EN

Stack Overflow用户
提问于 2021-10-20 12:49:57
回答 1查看 354关注 0票数 0

禁用旧的my_business接口(v4)后,我无法获取位置。我正在使用:

代码语言:javascript
运行
复制
$my_business_account = new Google_Service_MyBusinessAccountManagement($client);
$list_accounts_response = $my_business_account->accounts->listAccounts();
$account = $list_accounts_response[0];
$mybusinessService = new Google_Service_MyBusinessBusinessInformation($client);
$locations = $mybusinessService->accounts_locations;
$queryParams = [
    "pageSize" => 10,
    'readMask' => "user.display_name,photo"
];
$locationsList = $locations->listAccountsLocations($account->name, $queryParams);

我还是收到了400的回复:

代码语言:javascript
运行
复制
    Google\Service\Exception #400
{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "read_mask",
            "description": "Invalid field mask provided"
          }
        ]
      }
    ]
  }
}

在API文档https://developers.google.com/my-business/reference/businessinformation/rest/v1/accounts.locations/list

readMask字段是必填的,但不幸的是,我不知道PHP API客户端或REST (例如POSTMAN)的写入格式。有人能帮上忙吗?

EN

回答 1

Stack Overflow用户

发布于 2021-10-20 14:11:29

我的错误,使用readMask字段必须来自位置属性(https://developers.google.com/my-business/reference/businessinformation/rest/v1/locations),例如。名字,websiteUri等等。也许这对某些人有帮助。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69646296

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档