کدهای پاسخ وضعیت
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
کدهای وضعیت زیر را می توان در پاسخ های HTTP برگرداند.
کد HTTP | توضیحات HTTP | یادداشت |
---|
2xx | خوب | خطا نیست؛ با موفقیت بازگشت. این همچنین باید برای شکست های منطق تجاری استفاده شود (مثلا booking_failure در CreateBookingResponse پر شده است) |
400 | درخواست بد | درخواست بد/ استدلال نامعتبر (تاجر، سرویس، جایگاه پیدا نشد، تلاش برای رزرو یک اسلات نامعتبر، لغو رزروی که هرگز وجود نداشته است). |
401 | غیرمجاز | احراز هویت نشده (مدارک نامعتبر، دوباره سعی کنید وارد شوید). درخواست دارای اعتبار احراز هویت معتبر برای عملیات نیست. |
403 | ممنوع | اجازه رد/ممنوع (تماس گیرنده شناخته شده و رد شده است). این پاسخ نباید برای ردهایی که ناشی از فرسودگی برخی منابع است استفاده شود (به جای آن از Too Many Requests برای آن خطاها استفاده کنید). در صورتی که تماس گیرنده قابل شناسایی نباشد نباید Forbidden استفاده شود (به جای آن Unauthorized برای آن خطاها استفاده کنید). |
404 | پیدا نشد | یافت نشد (منبع پیدا نشد، آدرس اینترنتی نامعتبر، از جمله RPC های نامعتبر) |
409 | تعارض | این عملیات معمولاً به دلیل یک مشکل همزمانی مانند شکست چک ترتیبدهنده یا لغو تراکنش متوقف شد. |
429 | درخواست های خیلی زیاد | برخی از منابع تمام شده است، شاید سهمیه هر کاربر، یا شاید کل سیستم فایل خالی است. |
499 | درخواست بسته مشتری | این عملیات معمولاً توسط تماس گیرنده لغو شد. |
500 | خطای سرور داخلی | خطاهای داخلی این بدان معنی است که برخی از متغیرهای مورد انتظار سیستم اساسی شکسته شده اند. این کد خطا برای خطاهای جدی رزرو شده است. |
501 | اجرا نشده | عملیات اجرا نشده یا در این سرویس پشتیبانی/فعال نمی شود. |
503 | سرویس در دسترس نیست | این سرویس در حال حاضر در دسترس نیست. این به احتمال زیاد یک وضعیت گذرا است، که می توان با تلاش مجدد با عقب نشینی آن را اصلاح کرد. |
504 | مهلت زمانی دروازه | مهلت قبل از تکمیل عملیات به پایان رسید. برای عملیاتی که وضعیت سیستم را تغییر می دهد، حتی اگر عملیات با موفقیت به پایان رسیده باشد، ممکن است این خطا برگردانده شود. به عنوان مثال، یک پاسخ موفقیتآمیز از یک سرور میتوانست آنقدر به تأخیر بیفتد که مهلت آن به پایان برسد. |
گاهی اوقات ممکن است چندین کد خطا اعمال شود. سرویسها باید خاصترین کد خطای اعمال شده را برگردانند.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eHTTP status codes indicate the outcome of a request, ranging from success (2xx) to various error types.\u003c/p\u003e\n"],["\u003cp\u003eClient errors (4xx) signal issues with the request itself, such as invalid credentials (401) or missing resources (404).\u003c/p\u003e\n"],["\u003cp\u003eServer errors (5xx) indicate problems on the server side, including internal errors (500) or service unavailability (503).\u003c/p\u003e\n"],["\u003cp\u003eWhen multiple error codes apply, the most specific one should be used.\u003c/p\u003e\n"],["\u003cp\u003eBusiness logic failures, despite not being technical errors, should utilize a 2xx status code with further details provided in the response body.\u003c/p\u003e\n"]]],["HTTP responses can include various status codes: 2xx signifies success, used even for business logic failures. 400 indicates bad requests, 401 for unauthorized access, and 403 for forbidden actions. 404 means resource not found, 409 a conflict, and 429 too many requests. 499 denotes client-canceled operation, 500 internal errors, 501 unimplemented features, 503 service unavailability, and 504 gateway timeout. The most specific error code should be used when multiple codes apply.\n"],null,["# Status Response Codes\n\nThe following status codes can be returned in HTTP responses.\n\n| HTTP Code | HTTP Description | Notes |\n|-----------|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 2xx | OK | Not an error; returned on success. This should also be used for business logic failures (e.g. `booking_failure` in [`CreateBookingResponse`](/actions-center/verticals/reservations/waitlists/reference/booking-server-api-rest/e2e-methods/createbooking-method) is populated) |\n| 400 | Bad Request | Bad Request/Invalid Arguments (merchant, service, slot not found, trying to book an invalid slot, cancelling a booking that never existed). |\n| 401 | Unauthorized | Unauthenticated (invalid credentials, retry login). The request does not have valid authentication credentials for the operation. |\n| 403 | Forbidden | Permission denied/forbidden (caller is known and rejected). This response must not be used for rejections caused by exhausting some resource (use `Too Many Requests` instead for those errors). `Forbidden` must not be used if the caller can not be identified (use `Unauthorized` instead for those errors). |\n| 404 | Not Found | Not found (Resource not found, invalid url, including invalid RPCs) |\n| 409 | Conflict | The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort. |\n| 429 | Too Many Requests | Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space. |\n| 499 | Client Closed Request | The operation was cancelled, typically by the caller. |\n| 500 | Internal Server Error | Internal errors. This means that some invariants expected by the underlying system have been broken. This error code is reserved for serious errors. |\n| 501 | Not Implemented | The operation is not implemented or is not supported/enabled in this service. |\n| 503 | Service Unavailable | The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff. |\n| 504 | Gateway Timeout | The deadline expired before the operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long enough for the deadline to expire. |\n\nSometimes multiple error codes may apply. Services should return the most\nspecific error code that applies."]]