Query task file

Lists the file-level processing results of an import task, filtered by file status.

HTTP
GET $CLOUDSIGMA_API_BASE/task/files?task_id=$TASK_ID

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. Prepare personal access token, target workspace ID and task ID that can access the target workspace.

Query parameters

Replace $CLOUDSIGMA_API_KEY, $WORKSPACE_ID, and $TASK_ID with actual values.

Reading files in pages

Shell
curl "$CLOUDSIGMA_API_BASE/task/files?task_id=$TASK_ID&page=1&page_size=20" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"

Filter failed files

Status code 3 indicates a failed file. Repeated status Multiple statuses can be selected.

Shell
curl "$CLOUDSIGMA_API_BASE/task/files?task_id=$TASK_ID&status=3" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"

Add page to 1 until the cumulative number of files read reaches data.total, or the next page data.files is empty.

Shell
curl "$CLOUDSIGMA_API_BASE/task/files?task_id=$TASK_ID&page=2&page_size=20" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"

Reading files in pages

Parameter

Type

Required

Description

task_id

string

Yes

Import task ID.

page

integer

No

Page number. Page 1 is used when omitted or less than 1.

page_size

integer

No

Number of items per page. Use 20 when omitted or less than 1.

status

integer (integer array)

No

File status. 1 has been created, 2 is being processed, 3 has failed, and 4 has succeeded.

Successful response

data.total is the total number of files filtered in the current status; data.total_sum is the total number of files in this task.

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "files": [
      {
        "id": "file_01",
        "name": "orders.csv",
        "type": 1,
        "status": 3,
        "size": 1024,
        "reason": "parse failed",
        "path": "orders/orders.csv"
      }
    ],
    "total": 1,
    "total_sum": 3,
    "total_success": 2,
    "total_failed": 1
  }
}

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data.files

array

Current page file.

data.files[].id

string

File ID.

data.files[].name

string

File name.

data.files[].type

integer

File type code.

data.files[].status

integer

File status code.

data.files[].size

integer

File size in bytes.

data.files[].reason

string

Reason for failure.

data.files[].path

string

Source path.

data.total

integer

The total number of files under the current filter conditions.

data.total_sum

integer

The total number of files in the task.

data.total_success

integer

Number of successful files.

data.total_failed

integer

Number of failed files.

Error response

JSON
{
  "code": "ErrServer",
  "msg": "server error",
  "data": null
}

Field

Type

Description

code

string

error code.

msg

string

Readable error message.

data

null

The error response is null.

Last updated on