Download table data¶
Request the download results of table data.
POST https://moi.matrixorigin.cn/newmoi/catalog/table/download_data
Preparation before calling¶
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 has 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.$TABLE_ID: Table ID for which data is to be downloaded.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/table/download_data" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"id": '"$TABLE_ID"'
}'
Request body¶
The positioning method of the table is consistent with query table information: pass in id, or pass in name and database_id/database_name.
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Conditionally required |
Table ID. You do not need to pass the name after providing it. |
|
string |
Conditionally required |
Table name; required if |
|
integer |
Conditionally required |
Non-system database ID; mutually exclusive with |
|
string |
Conditionally required |
System database name; mutually exclusive with |
|
integer |
No |
Page number; only used for requests that keep the same shape as table data queries. |
|
integer |
No |
Number of items per page; only used for requests that maintain the same shape as table data queries. |
|
integer |
No |
Number of preview rows; only used for requests that keep the same shape as table data queries. |
|
boolean |
No |
Whether to request the total number of rows; only used to keep the same request shape as table data queries. |
Successful response¶
Returns 200 and download URL on success. When the URL in the response is an empty string, it means that there is no available download address and the download cannot be initiated based on this.
{
"code": "OK",
"msg": "OK",
"data": {
"url": ""
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
string |
Table data download address; if it is an empty string, there is no download address available. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "表定位参数无效",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
Invalid table ID, name positioning, or paging parameters. |
Use the table ID, or complete the table name and database location parameters. |
|
|
The current identity does not have table read permission. |
Check workspace and table authorizations. |
|
|
The system database does not support the current read path. |
Use supported table positioning methods instead. |
|
|
The service cannot generate download results. |
Record the request time and error message and try again; if it continues to fail, contact support. |
Follow-up operations¶
If you need to continue management after the download is completed, return to Query Catalog details.