API 公共結果代碼 (RstVal)
本文檔介紹 GIIP 平台 API 公共響應欄位
RstVal 和 RstMsg 的標準定義。
📋 概述
為了追蹤執行結果,所有 GIIP API 都會在響應數據的最頂層包含
RstVal(整型代碼)和 RstMsg(描述性消息)。這些值遵循數據庫中 tDefRst(結果定義)表的標準。
用戶提到的 tRstVal 指的是 tDefRst 表中的 drRstVal 欄位。開發者在進行 API 對接和開發時,可以參考以下定義的代碼來實現異常處理。
📡 主要結果代碼 (Major Codes)
| RstVal | RstMsg | 含義 | 備註 |
|---|---|---|---|
| 200 | Process has done successfully | 成功 | 標準成功響應 |
| 400 | No data found | 請求錯誤 | 缺少參數或數據為空 |
| 401 | Unauthorized | 認證失敗 | 憑證錯誤或會話已過期 |
| 403 | Forbidden | 無權限 | 訪問權限不足 |
| 404 | No data found | 未找到 | 資源不存在 |
| 500 | System error | 系統錯誤 | 服務器內部邏輯或數據庫錯誤 |
🔍 詳細結果代碼列表 (tDefRst)
系統內部使用的詳細結果代碼列表,包含針對積分、註冊、外部對接等特定領域的詳細消息。
| drRstVal | drRstMsg | 類別 |
|---|---|---|
| 100 | Starting Stored Procedure... | 系統 |
| 102 | Data is not match | 校驗 |
| 201 | Created successfully | 創建 |
| 204 | No content available | 數據 |
| 211 | It is clean email. go next... | 註冊 |
| 212 | Already registered user. | 註冊 |
| 220 | Charge process has done successfully | 支付/積分 |
| 221 | Point process has done successfully | 積分 |
| 230 | Buying process has done successfully | 購買 |
| 250 | Prayed successfully | 其他 |
| 300 | Permission error | 權限 |
| 301 | Not enough point | 積分 |
| 302 | Already data exists. | 重複 |
| 312 | Pre-registered but not have User data. | 註冊狀態 |
| 313 | Input status is lower than dbStatus. | 一致性 |
| 320 | It cannot be processed point processing | 積分 |
| 330 | You have NFT Token already. | 資產 |
| 332 | Already sold out. | 購買 |
| 333 | Event item limit reached. | 活動 |
| 390 | Already registered this wallet. | 認證/錢包 |
| 405 | Method not allowed | 服務器/HTTP |
| 409 | Conflict: Resource already exists | 狀態衝突 |
| 410 | Gone: Resource no longer available | 已失效/已刪除 |
| 420 | You don't have enough point | 積分 |
| 421 | Not same point and point history. | 數據一致性 |
| 502 | Bad Gateway: Upstream error | 網絡 |
💡 開發者建議
- 判定成功: 建議僅在
為RstVal
時繼續執行業務邏輯。200 - 錯誤處理:
系列代碼通常表示客戶端需要修正請求,而400
系列代碼則需要系統管理員介入檢查。500 - 消息使用:
主要用於開發者調試。對於最終用戶,建議根據其語言環境實現對應的提示邏輯。RstMsg
疑難排解
| 症狀 | 原因 | 解決 |
|---|---|---|
API 回應返回 為 | 憑證錯誤或會話已過期 | 重新確認認證金鑰並刷新會話後重新發送請求。 |
為 或 且數據為空 | 缺少必填參數或請求的資源不存在 | 檢查請求參數,並使用有效且存在的資源識別符重新請求。 |
為 / 導致處理中斷 | 未滿足積分不足等業務條件 | 查看 (如 Not enough point),滿足前置條件後重試。 |
返回 / | 伺服器內部邏輯/資料庫錯誤或上游閘道錯誤 | 請勿在用戶端重試,攜帶 聯繫系統管理員。 |
相關文檔: