錯誤代碼清單
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Google Civic Information API 第 2 版中的錯誤對應到 HTTP 狀態碼。下表列出各項錯誤並提供錯誤說明。每個錯誤回應都會包含錯誤的 reason
元素。在某些情況下,類似的錯誤可能會對應到同一個 HTTP 狀態碼和同一個 reason
元素。您可以使用 message
元素進一步區分這些情況以供偵錯。建議您不要編寫程式碼來檢查錯誤回應中的 message
元素。
此外,這個 API 也可能會傳回標準 Google API 錯誤。如需這些錯誤說明,請參閱「標準錯誤」頁面。
日後可能會加入其他錯誤。任何新的錯誤都會在 API 論壇中公布。
錯誤資料表
reason |
HTTP 狀態碼 |
message |
說明 |
parseError |
400 |
無法剖析地址 |
無法剖析傳送到 API 的地址。如果沒有完整指定地址,就可能發生這種情況。 |
required |
400 |
未提供地址 |
必須為這項要求指定地址。 |
invalidValue |
400 |
選舉不明 |
指定的選舉結果不明。這可能是因為要求的選舉 ID 無效。如果提供的地址沒有所選選舉 ID 的資料,也可能會發生這種情形。 |
invalidQuery |
400 |
選舉已結束 |
所要求的選舉已結束。無法取得這次選舉的資料。 |
unauthorized |
401 |
|
要求未取得適當授權。 |
limitExceeded |
403 |
擷取的 OCD ID 數量過多 |
遞迴要求需要處理太多部門。請嘗試套用其他篩選器,和/或使用受限的 OCD ID。在某些情況下,您可能需要先執行非遞迴查詢,然後對傳回的較小部門進行多次遞迴查詢。 |
notFound |
404 |
沒有這個地址的資訊 |
API 沒有這個地址的任何資訊。這可能是因為該地址並非美國居住地址。如果這個地址沒有選舉資料,就會發生這個錯誤。 |
conflict |
409 |
這個地址有衝突的資訊 |
這個地址有衝突的資訊。目前未使用。 |
backendError |
503 |
|
API 回應要求時發生問題。您可以重試這些類型的錯誤。 |
返回頁首
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-25 (世界標準時間)。"],[[["The Google Civic Information API v2 uses HTTP status codes to indicate errors, with further details provided in `reason` and `message` elements."],["Common errors include issues with address parsing, invalid election IDs, authorization problems, and exceeding request limits."],["Standard Google API errors may also occur and are documented separately."],["Refer to the error table for a comprehensive list of error codes, descriptions, and potential causes."],["New errors will be announced on the API forum, so stay updated for any changes."]]],[]]