Query table data¶
Read sampled data from a table. When the number of rows is not explicitly specified, the service returns 100 rows by default.
POST $CLOUDSIGMA_API_BASE/catalog/table/data
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/data" \
-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: use id, or use name plus database_id/database_name.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
integer condition required |
No |
Table ID. |
|
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, default |
|
integer |
No |
Number of lines per page, default |
|
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"
}
],
"total_rows": 120,
"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 |
The maximum number of rows in the current page. |
|
string |
Column name. |
|
string |
The data type of the column. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "表定位参数无效"
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
error message. |