Preview dashboard chart SQL¶
Execute a chart SQL preview, returning query results without saving the chart.
POST $CLOUDSIGMA_API_BASE/data-dashboards/{dashboard_id}/preview
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
Set the operation-specific values used in the request:
$DASHBOARD_ID:dashboard_idto use, specifying the target resource via the request path.
Request¶
Replace caller-specific values in the example with actual values.
curl -X POST "$CLOUDSIGMA_API_BASE/data-dashboards/$DASHBOARD_ID/preview" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"sql_text": "SELECT 1 AS value"
}'
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
sql_text | string | Required | The SQL to preview. |
Successful response¶
When the request is successful, the data of this operation is returned. Just because the write or run request has been accepted does not mean that the subsequent processing has been completed; please confirm the result based on the return status or subsequent query.
{
"code": 200,
"data": {"query_id": "query-001", "statement_id": "stmt-001", "status": "completed", "total": 1}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
Query ID. |
|
string |
Statement ID. |
|
string |
Query status. |
|
array |
Result column. |
|
array |
Result data. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "请求参数无效",
"data": null
}
| Field | Type | Description |
|---|---|---|
code | integer or string | Error code or status. |
message | string | Error message. |