logo
开发者文档
搜索
查询添加状态

查询添加状态

通过该 API 接口,发送请求以查询添加表数据任务的处理状态。

请求方式

GET

调用地址

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

调用验证

详情参见 API 概述的鉴权方式说明。

请求

请求示例

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

查询参数

字段 类型 必填 描述
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` must be unique, but the value '14' is duplicated (first at row `1`)." }, { "row": 4, "row_number_start": 0, "row_number_end": 0, "fail_reason": "`no` is required and must have a value; the current value is invalid or the property is missing. `no` must be unique, but the value is empty or the property is missing." } ] } ]
                      
                      [
    {
        "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` must be unique, but the value '14' is duplicated (first at row `1`)."
            },
            {
                "row": 4,
                "row_number_start": 0,
                "row_number_end": 0,
                "fail_reason": "`no` is required and must have a value; the current value is invalid or the property is missing. `no` must be unique, but the value is empty or the property is missing."
            }
        ]
    }
]

                    
此代码块在浮窗中显示

成功响应

字段 类型 描述
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 start与end用来标示错误所在的区间范围,以十行为一个单位。
row_number_end int start与end用来标示错误所在的区间范围,以十行为一个单位。
fail_reason string 错误原因的描述信息。

失败响应

字段 类型 描述
code int 错误码。
message string 错误详情。

错误码

Code Message
50000 系统内部错误

如何解读响应信息?

  1. 第一种失败情况:若导入的数据数据表里的数据发生冲突,所有的数据皆不会导入。
  • "fail_count" 的数量会等于 "total_count"。
  • "row" 会显示为 null。
  • 这时候直接找到 "fail_reason" 去定位问题即可。
  • "row_number_start" 和 "row_number_end" 可能会和实际的行数有出入,请直接忽略。
  1. 第二种失败情况:若导入的数据里自身有冲突,会将冲突的第一条数据导入,第二条数据舍弃。
  • "row" 会显示第二条冲突数据的行数。
  • "row_number_start" 和 "row_number_end" 为0。
  1. 其馀的失败情况:若导入的数据里不符合规定,该条数据则不会导入。
  • "row" 会显示不符合规定的数据行数。
  • "row_number_start" 和 "row_number_end" 为0。