リクエスト エラーを処理する
Routes 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 Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-02-06 UTC。
[null,null,["最終更新日 2025-02-06 UTC。"],[[["The Routes API provides error messages within its responses to indicate issues with the request."],["Errors are returned as JSON objects containing an `error` field with details about the issue, such as a code, message, and status."],["Missing API keys result in a `PERMISSION_DENIED` error with a 403 code."],["Omitting required parameters like `origin` leads to an `INVALID_ARGUMENT` error with a 400 code."],["Further details on errors and their handling can be found in the Google Cloud API Design Guide on Errors."]]],[]]