logo
開發者文件
搜尋
查詢表格資料新增進度

查詢表格資料新增進度

使用此 API 查詢新增表格資料任務的處理進度與狀態。

請求方法

GET

端點

https://api-${endpoint}.gptbots.ai/v1/database/query/import-results

授權

請參考 API 概覽 取得授權方式說明。API 金鑰(API Key)請於 API Key 頁面取得。

請求

請求範例

curl -X GET 'https://api-${endpoint}/v1/database/query/import-results?ids=68ec7ad3e307920f002648cd' \ -H 'Authorization: Bearer ${API Key}'
                      
                      curl -X GET 'https://api-${endpoint}/v1/database/query/import-results?ids=68ec7ad3e307920f002648cd' \
-H 'Authorization: Bearer ${API Key}'

                    
此代碼塊在浮窗中顯示

請求標頭

欄位 類型 描述
Authorization Bearer ${API Key} 使用 Authorization: Bearer ${API Key} 進行授權。API 金鑰(API Key)可於 API Key 頁面取得。

查詢參數

欄位 類型 是否為必填項 描述
ids list 新增資料任務的 ID 集合。

回應

回應範例

[ { "id": "68ec7ad3e307920f002648cd", "progress": 1, "status": "FAIL", "total_count": 4, "success_count": 0, "fail_count": 4, "fail_detail": [ { "row": null, "row_number_start": 1, "row_number_end": 2, "fail_reason": "(1062, \"Duplicate entry '14' for key 'product_feed_090833.id'\")" }, { "row": 2, "row_number_start": 0, "row_number_end": 0, "fail_reason": "`id` 必須唯一,但值 '14' 重複(首次出現在第 `1` 行)。" }, { "row": 4, "row_number_start": 0, "row_number_end": 0, "fail_reason": "`no` 為必填欄位且必須有值;目前值無效或屬性缺失。`no` 必須唯一,但值為空或屬性缺失。" } ] } ]
                      
                      [
    {
        "id": "68ec7ad3e307920f002648cd",
        "progress": 1,
        "status": "FAIL",
        "total_count": 4,
        "success_count": 0,
        "fail_count": 4,
        "fail_detail": [
            {
                "row": null,
                "row_number_start": 1,
                "row_number_end": 2,
                "fail_reason": "(1062, \"Duplicate entry '14' for key 'product_feed_090833.id'\")"
            },
            {
                "row": 2,
                "row_number_start": 0,
                "row_number_end": 0,
                "fail_reason": "`id` 必須唯一,但值 '14' 重複(首次出現在第 `1` 行)。"
            },
            {
                "row": 4,
                "row_number_start": 0,
                "row_number_end": 0,
                "fail_reason": "`no` 為必填欄位且必須有值;目前值無效或屬性缺失。`no` 必須唯一,但值為空或屬性缺失。"
            }
        ]
    }
]

                    
此代碼塊在浮窗中顯示

成功的回應

欄位 類型 描述
id string 任務的唯一 ID。
progress int 任務進度百分比,範圍 1~100。
status string 任務狀態。"FAIL" 表示失敗,"PENDING_PARSE" 表示檔案解析中,"AVAILABLE" 表示至少有一筆資料成功新增。
total_count int 處理的資料總筆數。
success_count int 成功處理的資料筆數。
fail_count int 失敗的資料筆數。
fail_detail Array<Object> 失敗資料的行號與原因。
row int 發生錯誤的行號,若為 null 表示無法對應到具體行。
row_number_start int 錯誤區間起始行號(以十行為單位)。
row_number_end int 錯誤區間結束行號(以十行為單位)。
fail_reason string 錯誤原因描述。

失敗回應

欄位 類型 描述
code int 錯誤代碼。
message string 錯誤詳情。

錯誤代碼

錯誤代碼 訊息
50000 內部系統錯誤

如何解讀回應?

  1. 失敗案例 1:若導入的資料資料表現有資料發生衝突,則所有資料皆不會被導入。

    • "fail_count" 會等於 "total_count"
    • "row"null
    • 此時,請檢查 "fail_reason" 來定位問題。
    • "row_number_start""row_number_end" 可能與實際行號不符,可忽略。
  2. 失敗案例 2:若導入的資料本身存在衝突,第一筆衝突資料會被導入,第二筆則會被捨棄。

    • "row" 會顯示第二筆衝突資料的行號。
    • "row_number_start""row_number_end" 為 0。
  3. 其他失敗情境:若導入的資料不符合格式或規則,該筆資料將不會被導入。

    • "row" 會顯示無效資料的行號。
    • "row_number_start""row_number_end" 為 0。

若需更多應用範例或情境說明,請參閱官方文件或聯繫技術支援。