HTTP 狀態碼
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
下列狀態碼可在 HTTP 回應中傳回。
HTTP 代碼 |
HTTP 說明 |
附註 |
2xx |
確定 |
非錯誤;於成功時傳回。這也應用於商業邏輯失敗 (例如 CreateBookingResponse 中的 booking_failure 已填入) |
400 |
要求無效 |
要求無效/引數無效 (找不到商家、服務、時段、嘗試預訂無效的時段、取消不存在的預訂)。 |
401 |
未授權 |
未驗證 (憑證無效,需要重新登入);要求沒有該作業的有效驗證憑證。 |
403 |
禁止存取 |
權限遭拒/禁止 (拒絕了已知的呼叫端)。對於因耗用某些資源所導致的拒絕情形,不得使用這項回應 (請針對這些錯誤改用 Too Many Requests )。如果無法識別呼叫端,請勿使用 Forbidden (若發生這類錯誤,請改用 Unauthorized )。 |
404 |
找不到 |
找不到,例如無法找到資源、網址無效,或是包含無效的遠端程序呼叫 (RPC)。 |
409 |
衝突 |
作業已取消,原因通常是排序器檢查失敗或交易取消等並行問題。 |
429 |
要求數超量 |
已耗盡某些資源 (可能是每位使用者的配額,也可能是整個檔案系統的空間不足)。 |
499 |
用戶端已結束要求 |
作業已取消 (通常由呼叫端取消)。 |
500 |
內部伺服器錯誤 |
發生內部錯誤,這表示基礎系統預期的某些不變量已遭破壞。此錯誤代碼僅在發生嚴重錯誤時使用。 |
501 |
未執行 |
未實作該作業,或在此服務中不支援/未啟用該作業。 |
503 |
無法使用服務 |
服務目前無法使用。這很可能是暫時性問題,可透過重試輪詢來解決。 |
504 |
閘道逾時 |
已超過期限,但作業尚未完成。針對會變更系統狀態的作業,即使作業順利完成也有可能會傳回這個錯誤,舉例來說,雖然伺服器成功提供回應,但因為延遲時間過長而導致超過期限。 |
有時可能適用多個錯誤代碼。在這類情況下,服務應傳回最適當的明確錯誤代碼。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\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 like bad requests, authentication failures, or missing resources.\u003c/p\u003e\n"],["\u003cp\u003eServer errors (5xx) represent problems on the server side, such as internal errors or service unavailability.\u003c/p\u003e\n"],["\u003cp\u003eSpecific error codes provide detailed information about the nature of the problem, enabling appropriate action.\u003c/p\u003e\n"],["\u003cp\u003eWhen multiple error codes could apply, the most specific one should be returned.\u003c/p\u003e\n"]]],["HTTP responses can include various status codes. Successful operations return a 2xx code. Client-side errors include 400 (Bad Request), 401 (Unauthorized), 403 (Forbidden), 404 (Not Found), 409 (Conflict), 429 (Too Many Requests), and 499 (Client Closed Request). Server-side errors include 500 (Internal Server Error), 501 (Not Implemented), 503 (Service Unavailable), and 504 (Gateway Timeout). The most specific error code should be returned when multiple codes apply.\n"],null,["# HTTP Status 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/local-services/e2e/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."]]