Preview table data¶
Preview table data without modifying table content.
POST $CLOUDSIGMA_API_BASE/catalog/table/preview
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. First query the object in the database to obtain the target table ID, or prepare the table name and database positioning parameters. Prepare the personal access token, target workspace ID, and table location information that can access the target workspace.
Request body¶
curl -X POST "$CLOUDSIGMA_API_BASE/catalog/table/preview" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"id": '"$TABLE_ID"'
}'
The positioning method of the table is consistent with query table information: pass in id, or pass in name and database_id/database_name.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
integer condition required |
No |
Table ID. You do not need to pass the name after providing it. |
|
string condition is required |
No |
Table name. Required when |
|
integer condition required |
No |
Non-system database ID. Mutually exclusive with |
|
string condition is required |
No |
System database name. Mutually exclusive with |
|
integer |
No |
Page number. If it is not transmitted or is less than or equal to |
|
integer |
No |
Number of items per page. Use |
|
integer |
No |
Number of preview rows, there is currently no upper limit for additional rows. |
|
boolean |
No |
Whether to count the total number of rows. Omitted or null Defaults to true. |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"data": [
[
"1",
"100.00"
]
],
"columns": [
{
"name": "id",
"type": "INT"
},
{
"name": "amount",
"type": "DECIMAL"
}
],
"page": 1,
"page_size": 100
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
array |
row data. Each inner array is arranged in the order |
|
array of object |
column information. |
|
integer |
The total number of rows in the table. Returned only when |
|
integer |
Current page number. |
|
integer |
Maximum number of lines per page. |
|
string |
Column name. |
|
string |
The data type of the column. |
Error response¶
The following is a common error response for HTTP 500. Some deployments may also return this response when previewing a non-existent table. ErrServer cannot distinguish between table non-existence and service failure, and cannot judge whether the table exists based on this. An invalid table location parameter is a parameter error and is different from passing in a table ID that is in a valid format but does not exist.
When the preview fails, first use the same table positioning parameter query table information. When the table information returns 404, check the table ID or name and database before calling the preview. When the table information can be read but the preview still fails, keep the HTTP status, business code and request time, and contact support.
{
"code": "ErrServer",
"msg": "服务器内部错误"
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
error message. |