رسیدگی به خطاهای درخواست
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
توسعه دهندگان منطقه اقتصادی اروپا (EEA). 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"
}
}
برای اطلاعات بیشتر در مورد خطاها و رسیدگی به خطاها، به خطاها مراجعه کنید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-06-20 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-06-20 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe Routes API provides error messages within its responses to indicate issues with the request.\u003c/p\u003e\n"],["\u003cp\u003eErrors are returned as JSON objects containing an \u003ccode\u003eerror\u003c/code\u003e field with details about the issue, such as a code, message, and status.\u003c/p\u003e\n"],["\u003cp\u003eMissing API keys result in a \u003ccode\u003ePERMISSION_DENIED\u003c/code\u003e error with a 403 code.\u003c/p\u003e\n"],["\u003cp\u003eOmitting required parameters like \u003ccode\u003eorigin\u003c/code\u003e leads to an \u003ccode\u003eINVALID_ARGUMENT\u003c/code\u003e error with a 400 code.\u003c/p\u003e\n"],["\u003cp\u003eFurther details on errors and their handling can be found in the Google Cloud API Design Guide on Errors.\u003c/p\u003e\n"]]],[],null,["# Handle request errors\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nThe Routes 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)."]]