Query table overview¶
List the tables and column names of each table in the specified database.
POST https://moi.matrixorigin.cn/newmoi/catalog/table/overview
Preparation before calling¶
First query the database list to obtain the database ID. Prepare the personal access token, target workspace ID, and database ID that have access to the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed throughX-Workspace-IDHeader.$DATABASE_ID: The database ID to be queried.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/table/overview" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"id": '"$DATABASE_ID"'
}'
Request body¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Yes |
Database ID. |
Successful response¶
Returns 200 and table overview on success.
{
"code": "OK",
"msg": "OK",
"data": {
"tables": [
{
"name": "orders",
"columns": ["id", "amount"]
}
]
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
array |
Overview of tables in the database. |
|
string |
Table name. |
|
string[] |
List of table column names. |
In this document, [] after a type means an array; for example, string[] is an array of strings. In field paths, [] means each item in an array; for example, data.tables[].name is the name field of each item in data.tables.
Error response¶
{
"code": "ErrServer",
"msg": "服务器内部错误",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The database ID is invalid. |
Use a valid database ID. |
|
|
The current identity does not have permission to read the database. |
Use credentials with read permissions. |
|
|
The server failed to generate table overview. |
Try again later. |