Download execution result

Download the results of a successfully completed SQL query as a CSV file.

HTTP
POST $CLOUDSIGMA_API_BASE/query/result/download

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.

  1. Prepare personal access token and target workspace ID that can access the target workspace.

  2. Query the SQL execution status, confirm that the query is successful, and record the result ID (statement_id) in the response.

Request body

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

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/query/result/download" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d "{\"statement_id\": \"$STATEMENT_ID\"}" \
  --output result.csv

Parameter

Type

Required

Description

statement_id

string

Yes

The result ID of a successful execution of the view.

Successful response

response part

value

Description

response body

CSV file content

Complete query results.

Content-Type

text/csv; charset=utf-8

The media type and character set of the response body.

Content-Disposition

attachment; filename*=UTF-8’’query-result-20260824-175552.csv

Recommended download file name. The time part is generated by the server.

Content-Length

file bytes

CSV file size.

Error response

The response is JSON on failure.

JSON
{
  "code": 404,
  "message": "SQL 查询结果不存在"
}

Field

Type

Description

code

integer or string

SQL processing errors may be numeric status codes. Authentication or general service errors may be string error codes.

message

string

error message.

Errors are encapsulated in two ways: The SQL processing path uses {“code”:400,”message”:”…”}. Authentication or general service error using {“code”:”ErrServer”,”msg”:”…”}. Both message and msg are readable error messages, which should be read based on the actual fields and cannot be judged only by the numerical code.

Last updated on