错误案例
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
以下部分重点介绍了 Mobile Data Plan Sharing API 向调用方返回错误的最常见场景。如果错误仍然存在,请发送电子邮件至 mdp-support@google.com 寻求支持,并分享正在调用的网址以及请求正文。
HTTP 404 Not Found
HTTP 404 错误最常见的原因是,GTAF 无法找到应向其发送通知的用户的 GCM 令牌。如果设备没有机会或未能向 GTAF 注册 CPID 和关联的 GCM 令牌,就会发生这种情况。如果设备注册的是 GTAF 的预生产实例,而通知发送到的是 GTAF 的生产实例,也可能会发生这种情况。
如需诊断此错误,请执行以下操作:
- 确保 MDP 界面已在设备上成功加载。
- 确保调用中的路径参数和查询参数已进行网址编码。
- 同时尝试预生产 (preprod-mobiledataplansharing.googleapis.com) 和生产端点 (mobiledataplansharing.googleapis.com)。
HTTP 400 Bad Request
当发送到 GTAF 的请求正文无效时,会发生此错误。最常见的应用场景包括:
- PlanStatus 中的 updateTime 未提供或是在未来。
- PlanStatus 中的 expireTime 未提供或已过期。
- 缺少 userKey 查询参数。
- 缺少构建通知所需的所有字段。
如需详细了解如何触发通知,请参阅通知指南。
HTTP 409 Conflict
如果缓存中的 PlanStatus 更新(即 updateTime 更近),GTAF 会向调用方返回此错误。请检查您的日志,看看是否已为此用户推送 PlanStatus。
HTTP 403 Forbidden
如果调用方未获授权针对网址中使用的特定 ASN 调用移动数据流量共享 API,则 GTAF 会返回此错误。如需诊断此错误,请执行以下操作:
- 验证是否已在 Google Cloud 控制台的 API 库中启用 API。
- 用于调用的服务账号已添加到运营商的 ISP 门户。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-26。"],[],["The Mobile Data Plan Sharing API returns errors in specific scenarios. HTTP 404 occurs when the user's GCM token is not found. Actions to diagnose: ensure MDP UI loads, check URL encoding, and try pre-prod/prod endpoints. HTTP 400 occurs with invalid request bodies, requiring valid `updateTime` and `expireTime`, a `userKey`, and all fields needed for notifications. HTTP 409 means the cached `PlanStatus` is more recent. HTTP 403 indicates caller authorization issues; ensure the API is enabled and the service account is in the ISP portal.\n"]]