错误场景
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
以下各部分重点介绍了 Mobile Data Plan Sharing API 向调用方返回错误的最常见场景。如果错误依然存在,请联系 mdp-support@google.com 以获取支持,并分享要调用的网址以及请求正文。
找不到 HTTP 404
HTTP 404 错误的最常见原因是 GTAF 找不到应为其发送通知的用户的 GCM 令牌。如果设备没有机会或未能向 GTAF 注册 CPID 和关联的 GCM 令牌,就会发生这种情况。如果设备已注册 GTAF 预生产实例,且正在向 GTAF 的生产实例发送通知,也会发生这种情况。
如需诊断此错误,请执行以下操作:
- 确保 MDP 界面在设备上成功加载。
- 确保调用中的路径参数和查询参数经过网址编码。
- 请尝试前生产环境 (preprod-mobiledataplansharing.googleapis.com) 和生产端点 (mobiledataplansharing.googleapis.com)。
HTTP 400 请求错误
发送至 GTAF 的请求正文无效时,就会出现此错误。最常见的情况包括:
- PlanStatus 中的 updateTime 未提供或是将来的时间。
- PlanStatus 中的 expiresTime 未提供或属于过去的时间。
- 缺少 userKey 查询参数。
- 构建通知所需的全部字段均不存在。如需详细了解如何触发通知,请参阅通知指南。
HTTP 409 冲突
如果缓存中的 PlanStatus 比更新请求中发送的时间更近(即 updateTime 较晚),GTAF 会向调用方返回此错误。请检查您的日志,了解是否已为此用户推送 PlanStatus。
HTTP 403 禁止
如果调用方无权为网址中使用的特定 ASN 调用移动流量套餐共享 API,GTAF 会返回此错误。如需诊断此错误,请执行以下操作:
1. 验证是否已在 Google Cloud Console API 库中启用 API。1. 用于通话的服务帐号已添加到运营商的 ISP 门户中。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2022-09-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):2022-09-26。"],[[["This page outlines common errors when using the Mobile Data Plan Sharing API, such as HTTP 404, 400, 409, and 403 errors, and provides troubleshooting steps."],["HTTP 404 errors typically occur when GTAF cannot find the user's GCM token, potentially due to device registration issues or using the wrong GTAF instance."],["HTTP 400 errors indicate an invalid request body, often caused by incorrect timestamps or missing parameters in the PlanStatus."],["HTTP 409 errors suggest that a more recent PlanStatus already exists in the cache, requiring a review of previous updates."],["HTTP 403 errors arise from authorization issues, necessitating verification of API enablement and service account permissions within the carrier's ISP portal."]]],["The Mobile Data Plan Sharing API returns errors in specific scenarios. A 404 error indicates a missing GCM token; solutions include ensuring the UI loads, URL encoding parameters, and checking both endpoints. A 400 error signals an invalid request body, often due to incorrect `updateTime`, `expireTime`, missing `userKey`, or incomplete notification details. A 409 error arises from sending outdated `PlanStatus`, and a 403 error occurs if authorization is lacking; checking API enablement and service account status is advised. For persistent errors, contact mdp-support@google.com.\n"]]