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 the X-API-Key Header.

  • $WORKSPACE_ID: Target workspace ID, passed through X-Workspace-ID Header.

  • $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

id

integer

Conditionally required

Table ID. You do not need to pass the name after providing it.

name

string

Conditionally required

Table name; required if id is not provided.

database_id

integer

Conditionally required

Non-system database ID; mutually exclusive with database_name.

database_name

string

Conditionally required

System database name; mutually exclusive with database_id.

page

integer

No

Page number; only used for requests that keep the same shape as table data queries.

page_size

integer

No

Number of items per page; only used for requests that maintain the same shape as table data queries.

preview_lines

integer

No

Number of preview rows; only used for requests that keep the same shape as table data queries.

include_total

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

code

string

OK on success.

msg

string

OK on success.

data.url

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

400

ErrParamInvalid

Invalid table ID, name positioning, or paging parameters.

Use the table ID, or complete the table name and database location parameters.

403

ErrForbidden

The current identity does not have table read permission.

Check workspace and table authorizations.

409

ErrReadonlySystemDatabase

The system database does not support the current read path.

Use supported table positioning methods instead.

500

ErrServer

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.

Last updated on