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

Google My Business评论回复API 404错误排查求助

排查Google My Business API评论回复404错误的关键点

核心原因:请求的资源不存在或权限不足(GMB API会用404掩盖部分权限问题)

以下是逐一排查的方向:


1. 验证所有ID参数的正确性

  • account_id:必须是Google My Business管理账号的ID,而非GCP项目ID。可通过调用accounts.list接口获取有效账号列表,确认你使用的ID在返回结果中。
  • location_id:必须是对应account_id下的有效地点ID,需通过accounts.locations.list接口获取,确保该地点属于目标账号,且未被移除或暂停。
  • review_id:必须是该location_id下存在的有效评论ID,通过accounts.locations.reviews.list接口获取该地点的评论列表,核对你使用的review_id是否在其中(注意评论不能是已删除状态)。

2. 检查权限配置

  • 服务账号(ServiceAccount)场景:
    • 需将服务账号的邮箱(client_email)添加为Google My Business账号的管理员角色,而非普通成员。如果权限不足,GMB API会返回404而非403,这是常见的坑。
    • 确认scopes仅保留https://www.googleapis.com/auth/business.manage即可,plus.business.manage已废弃,无需添加。
  • OAuth2令牌场景:
    • 确保生成令牌的账号拥有目标GMB账号的管理权限,且授权时请求了business.manage scope。

3. 确认API端点和调用方式

  • 检查请求路径格式:正确路径应为accounts/{account_id}/locations/{location_id}/reviews/{review_id}/reply,你的代码格式无误,但需确保无拼写错误(比如大小写、多余符号)。
  • 确认发现文档版本匹配:你使用的mybusiness_google_rest_v4p9.json对应v4版本API,无需调整。

4. 分步验证API调用

先通过以下基础调用确认资源存在:

  1. 调用service.accounts().list().execute(),确认account_id有效。
  2. 调用service.accounts().locations().list(parent=f'accounts/{account_id}').execute(),确认location_id属于该账号。
  3. 调用service.accounts().locations().reviews().list(parent=f'accounts/{account_id}/locations/{location_id}').execute(),确认review_id存在于该地点的评论列表中。

内容的提问来源于stack exchange,提问作者Nagesh Singh Chauhan

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.16 10:42:52