You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为何locations.getGoogleUpdated API始终返回404错误?

收到Google Business Profile API的GOOGLE_UPDATE通知后调用接口返回404问题

收到Google Business Profile API的GOOGLE_UPDATE通知后,我尝试查看门店位置的变更内容,参考官方文档中locations.getGoogleUpdated的相关说明。

在API Playground中测试的结果如下:
Google Playground测试结果

Java代码测试也得到相同的404结果:

String locationId="locations/"+rec.locationName.split("locations/")[1];
String url="https://mybusinessbusinessinformation.googleapis.com/v1/locations/"+locationId +":googleUpdated";
HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create(url))
        .GET()
        .header("Authorization", "Bearer " + accessToken)
        .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(" statusCode "+ response.statusCode());

所有GOOGLE_UPDATE通知对应的接口响应均为statusCode 404,请问代码或请求存在什么问题?


问题排查与修正建议

  • Location ID拼接重复:
    你的代码中locationId拼接后会变成locations/xxx,而接口URL本身已经包含locations/,最终生成的URL会是https://mybusinessbusinessinformation.googleapis.com/v1/locations/locations/xxx:googleUpdated,路径重复直接导致404。正确做法是直接提取rec.locationName中locations/之后的部分:

    String locationId = rec.locationName.split("locations/")[1];
    
  • API端点验证:
    核对官方文档确认locations.getGoogleUpdated接口的正确域名与路径,避免混用不同Google Business Profile相关API的端点。

  • 权限与有效性检查:

    1. 确认请求使用的AccessToken包含https://www.googleapis.com/auth/business.manage权限范围,且授权账号拥有该门店的管理权限;
    2. 检查GOOGLE_UPDATE通知是否过期,部分变更记录存在有效期,逾期调用会返回404。

内容的提问来源于stack exchange,提问作者Shila Mosammami

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 11:36:10