Błędy obsługi żądań
Interfejs Routes API zwraca komunikaty o błędach w ramach odpowiedzi na wywołanie metody. Jeśli na przykład pominiesz klucz interfejsu API w żądaniu, metoda zwróci:
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"status": "PERMISSION_DENIED"
}
}
Jeśli pominiesz wymagany parametr treści, np. origin
, metoda zwraca:
{
"error": {
"code": 400,
"message": "Origin and destination must be set.",
"status": "INVALID_ARGUMENT"
}
}
Więcej informacji o błędach i ich obsłudze znajdziesz w artykule Błędy.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-02-06 UTC.
[null,null,["Ostatnia aktualizacja: 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."]]],[]]