Routes Preferred API 目前仅适用于部分客户。如需了解详情,请
与销售人员联系。
处理请求错误
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Routes Preferred API 会在响应方法调用时返回错误消息。例如,如果您从请求中省略 API 密钥,该方法会返回:
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"status": "PERMISSION_DENIED"
}
}
如果您省略了必需的正文参数(例如 origin
),该方法会返回:
{
"error": {
"code": 400,
"message": "Origin and destination must be set.",
"status": "INVALID_ARGUMENT"
}
}
如需详细了解错误和错误处理,请参阅错误。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-11-23。
[null,null,["最后更新时间 (UTC):2024-11-23。"],[[["\u003cp\u003eThe Routes Preferred API utilizes error messages within its responses to indicate issues with method calls.\u003c/p\u003e\n"],["\u003cp\u003eThese error messages provide specific details, including an error code, a descriptive message, and a status indicator, to help identify the cause of the error.\u003c/p\u003e\n"],["\u003cp\u003eCommon errors include missing API keys, resulting in a "PERMISSION_DENIED" status, or omitting required parameters like "origin," leading to an "INVALID_ARGUMENT" status.\u003c/p\u003e\n"],["\u003cp\u003eFor a comprehensive understanding of errors and their handling within Google Cloud APIs, refer to the provided documentation on Errors.\u003c/p\u003e\n"]]],[],null,["# Handle request errors\n\nThe Routes Preferred API returns error messages as part of the\nresponse to a method call. For example, if you omit the API key from the\nrequest, the method returns: \n\n```json\n{\n \"error\": {\n \"code\": 403,\n \"message\": \"The request is missing a valid API key.\",\n \"status\": \"PERMISSION_DENIED\"\n }\n}\n```\n\nIf you omit a required body parameter, such as `origin`, the method\nreturns: \n\n```json\n{\n \"error\": {\n \"code\": 400,\n \"message\": \"Origin and destination must be set.\",\n \"status\": \"INVALID_ARGUMENT\"\n }\n}\n```\n\nFor more information on errors and error handling, see\n[Errors](https://cloud.google.com/apis/design/errors)."]]