Download table data as CSV¶
Download a specified Catalog table’s query results directly as a CSV with headers, reading at most 1,000,000 rows.
POST https://api.moi.matrixorigin.cn/v5/catalog/table/download
Before you call this API¶
Set BASE_URL to the product API prefix https://api.moi.matrixorigin.cn/v5; use the corresponding product API URL for a dedicated deployment.
Obtain a positive integer ID for a queryable table. Prepare a personal access token with table.query, a workspace ID, and a local destination path. BASE_URL includes the product prefix in the same environment; MOI_KEY and WORKSPACE_ID are product credentials and workspace ID. Example IDs and data are placeholders.
OUTPUT_FILE specifies the local destination path.
Request body¶
curl --fail-with-body -sS -X POST "$BASE_URL/catalog/table/download" \
-H "X-API-Key: $MOI_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{"id": 31}' \
-o "$OUTPUT_FILE"
Field |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Yes |
Table ID. |
No pagination, resume, or total-row parameters. Confirm a separate export approach for data exceeding the row limit.
Successful response¶
id,amount
1,12.50
Response item |
Type |
Description |
|---|---|---|
Content-Type |
string |
text/csv; charset=utf-8 on success. |
Content-Disposition |
string |
Attachment name uses the URL-encoded table name and .csv extension. |
Response body |
bytes (byte stream) |
CSV header and data rows. Inspect actual file contents after the read completes without client errors. |
Failures before streaming may return JSON business errors. Failures after bytes have been sent interrupt the connection. HTTP 200 or a partial file does not establish a complete download.
Error responses¶
{
"code": "ErrParamInvalid",
"msg": "示例错误信息"
}
HTTP |
code |
Condition |
|---|---|---|
400 |
ErrParamInvalid |
Invalid request JSON. |
409 |
ErrReadonlySystemDatabase |
Table ID is not positive. |
404 |
ErrNotFound |
Business read confirms the target table does not exist. |
For identity, permission, and dependency failures, use actual code, msg, and diagnostic fields. Error wording may vary by language.