View tables and views in a database¶
List the tables and views in a database. Select subsequent actions based on the object type.
POST $CLOUDSIGMA_API_BASE/meta/db/table
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 and target workspace ID that can access the target workspace.
View database, select and record the database name (
db_name).
Request body¶
Replace $CLOUDSIGMA_API_KEY, $WORKSPACE_ID, $DATABASE in the example with actual values.
curl -X POST "$CLOUDSIGMA_API_BASE/meta/db/table" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{
\"name\": \"$DATABASE\"
}"
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
The name of the database to view. |
Successful response¶
{
"code": 200,
"data": {
"db_name": "sales",
"tables": {
"tables": [
{
"name": "orders",
"owner": "",
"created": "",
"rows": 0,
"size": 0
}
],
"total": 1
},
"views": {
"tables": [],
"total": 0
}
}
}
Field |
Type |
Description |
|---|---|---|
|
integer |
200 on success. |
|
object |
Tables and views in the database. |
|
string |
The name of the database being viewed. |
|
object |
List of tables and their total number. |
|
object |
List of views and their total number. |
|
array of objects or null |
Table list. The service may return |
|
integer |
The number of objects in the table list. |
|
string |
Table name. Used to view table information, fields or table creation statements. |
|
string |
The current list is not populated with owners, returning an empty string. |
|
string |
The current list is not populated with creation time and returns an empty string. |
|
integer |
The current list uses 0 placeholder, not the actual number of rows. When the number of rows is required, call the view table information interface. |
|
integer |
The current list is not padded to size, returning 0. |
|
array of objects or null |
View list. The service may return |
|
integer |
The number of objects in the view list. |
|
string |
View name. Used to view the create statement of the view or delete the view. |
|
string |
The current list is not populated with owners, returning an empty string. |
|
string |
The current list is not populated with creation time and returns an empty string. |
|
integer |
The current list uses 0 placeholder, not the actual number of rows. When the number of rows is required, call the view table information interface. |
|
integer |
The current list is not padded to size, returning 0. |
Error response¶
{
"code": 400,
"message": "name 不能为空"
}
Field |
Type |
Description |
|---|---|---|
|
integer or string |
Error code or status code. |
|
string |
error message. |