Chuyển tới nội dung chính

Datasets API

BI datasets: sources, columns, metrics, folders, trash + bookmarks.

This page lists 21 endpoints (OpenAPI tag datasets). It is generated from openapi.json; see the REST API overview for authentication, CSRF and error conventions.

MethodPathOperation idNotes
GET/api/ws/{workspace}/datasetsds_list
POST/api/ws/{workspace}/datasetsds_create
GET/api/ws/{workspace}/datasets/{id}ds_get
PUT/api/ws/{workspace}/datasets/{id}ds_update
DELETE/api/ws/{workspace}/datasets/{id}ds_remove
POST/api/ws/{workspace}/datasets/{id}/bookmarkds_bookmark_add
DELETE/api/ws/{workspace}/datasets/{id}/bookmarkds_bookmark_remove
PUT/api/ws/{workspace}/datasets/{id}/certificationds_set_certification
POST/api/ws/{workspace}/datasets/{id}/columnsds_add_column
PUT/api/ws/{workspace}/datasets/{id}/columns/{column_name}ds_update_column
DELETE/api/ws/{workspace}/datasets/{id}/columns/{column_name}ds_delete_column
POST/api/ws/{workspace}/datasets/{id}/datads_dataObject-scoped dataset data-preview: runs ONLY a bounded SELECT * FROM <the dataset's own source> LIMIT n (n from the optional body, clamped to [100, 1000]).
PATCH/api/ws/{workspace}/datasets/{id}/folderds_set_folder
POST/api/ws/{workspace}/datasets/{id}/metricsds_add_metric
PUT/api/ws/{workspace}/datasets/{id}/metrics/{metric_id}ds_update_metric
DELETE/api/ws/{workspace}/datasets/{id}/metrics/{metric_id}ds_delete_metric
PUT/api/ws/{workspace}/datasets/{id}/metrics/{metric_id}/certificationds_set_metric_certification
POST/api/ws/{workspace}/datasets/{id}/refreshds_refresh
POST/api/ws/{workspace}/datasets/{id}/restoreds_restore
POST/api/ws/{workspace}/datasets/{id}/trashds_trash
GET/api/ws/{workspace}/datasets/{id}/usageds_usage

GET /api/ws/{workspace}/datasets​

Operation id: ds_list. Auth: Session cookie. Forbidden (403): Missing dataset:read permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
trashedquerybooleannoList only trashed datasets when true

Response 200 (application/json): array of DatasetSummaryDto

FieldTypeRequiredDescription
idstringyes
namestringyes
descriptionstringyes
database_idstringyes
kindstringyes
catalogstring, nullableno
schemastring, nullableno
tablestring, nullableno
column_countinteger (int64)yes
folder_idstring, nullableno
updated_atstring (date-time)yes
deleted_atstring (date-time), nullableno
bookmarkedbooleanyes
certifiedbooleanyesCertified as a trusted/official dataset (for a list badge).
StatusMeaning
200Datasets in the workspace
401Not authenticated
403Missing dataset:read permission
500Internal error

POST /api/ws/{workspace}/datasets​

Operation id: ds_create. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:manage permission (or the database is not granted).

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug

Request body (application/json): CreateDataset

FieldTypeRequiredDescription
namestringyes
database_idstring (uuid)yes
descriptionstringno
sourceCreateSourceyes

Response 200 (application/json): DatasetDetailDto

FieldTypeRequiredDescription
idstringyes
namestringyes
descriptionstringyes
database_idstringyes
kindstringyes
catalogstring, nullableno
schemastring, nullableno
tablestring, nullableno
sqlstring, nullableno
updated_atstring (date-time)yes
columnsDatasetColumnDto[]yes
metricsMetricDto[]yes
certifiedbooleanyesCertified as a trusted/official dataset.
certified_bystringyes
certification_detailsstringyes
StatusMeaning
200Dataset created (columns introspected from the source)
400Invalid source or introspection failed
401Not authenticated
403Missing dataset:manage permission (or the database is not granted)
500Internal error

GET /api/ws/{workspace}/datasets/{id}​

Operation id: ds_get. Auth: Session cookie. Forbidden (403): Missing dataset:read permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Response 200 (application/json): DatasetDetailDto

FieldTypeRequiredDescription
idstringyes
namestringyes
descriptionstringyes
database_idstringyes
kindstringyes
catalogstring, nullableno
schemastring, nullableno
tablestring, nullableno
sqlstring, nullableno
updated_atstring (date-time)yes
columnsDatasetColumnDto[]yes
metricsMetricDto[]yes
certifiedbooleanyesCertified as a trusted/official dataset.
certified_bystringyes
certification_detailsstringyes
StatusMeaning
200Dataset detail (columns + metrics)
401Not authenticated
403Missing dataset:read permission
404No such dataset in this workspace
500Internal error

PUT /api/ws/{workspace}/datasets/{id}​

Operation id: ds_update. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:manage permission, or not the dataset owner.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Request body (application/json): UpdateDataset

FieldTypeRequiredDescription
namestringyes
descriptionstringno
sqlstring, nullableno

Response 200 (application/json): DatasetDetailDto

FieldTypeRequiredDescription
idstringyes
namestringyes
descriptionstringyes
database_idstringyes
kindstringyes
catalogstring, nullableno
schemastring, nullableno
tablestring, nullableno
sqlstring, nullableno
updated_atstring (date-time)yes
columnsDatasetColumnDto[]yes
metricsMetricDto[]yes
certifiedbooleanyesCertified as a trusted/official dataset.
certified_bystringyes
certification_detailsstringyes
StatusMeaning
200Dataset updated
401Not authenticated
403Missing dataset:manage permission, or not the dataset owner
404No such dataset in this workspace
500Internal error

DELETE /api/ws/{workspace}/datasets/{id}​

Operation id: ds_remove. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:manage permission, or not the dataset owner.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Response 200 (application/json): Ack

FieldTypeRequiredDescription
okbooleanyes
StatusMeaning
200Dataset deleted
401Not authenticated
403Missing dataset:manage permission, or not the dataset owner
404No such dataset in this workspace
500Internal error

POST /api/ws/{workspace}/datasets/{id}/bookmark​

Operation id: ds_bookmark_add. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:read permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Response 200 (application/json): Ack

FieldTypeRequiredDescription
okbooleanyes
StatusMeaning
200Dataset bookmarked for the caller
401Not authenticated
403Missing dataset:read permission
404No such dataset in this workspace
500Internal error

DELETE /api/ws/{workspace}/datasets/{id}/bookmark​

Operation id: ds_bookmark_remove. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:read permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Response 200 (application/json): Ack

FieldTypeRequiredDescription
okbooleanyes
StatusMeaning
200Dataset bookmark removed for the caller
401Not authenticated
403Missing dataset:read permission
404No such dataset in this workspace
500Internal error

PUT /api/ws/{workspace}/datasets/{id}/certification​

Operation id: ds_set_certification. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:certify permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Request body (application/json): SetDatasetCertification

FieldTypeRequiredDescription
certifiedbooleanyes
detailsstringnoIgnored when certified is false — withdrawing clears the note rather than leaving a stale justification attached to an uncertified dataset.

Response 200 (application/json): DatasetDetailDto

FieldTypeRequiredDescription
idstringyes
namestringyes
descriptionstringyes
database_idstringyes
kindstringyes
catalogstring, nullableno
schemastring, nullableno
tablestring, nullableno
sqlstring, nullableno
updated_atstring (date-time)yes
columnsDatasetColumnDto[]yes
metricsMetricDto[]yes
certifiedbooleanyesCertified as a trusted/official dataset.
certified_bystringyes
certification_detailsstringyes
StatusMeaning
200Certification set
401Not authenticated
403Missing dataset:certify permission
404No such dataset in this workspace
500Internal error

POST /api/ws/{workspace}/datasets/{id}/columns​

Operation id: ds_add_column. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:manage permission, or not the dataset owner.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Request body (application/json): AddColumnBody

FieldTypeRequiredDescription
column_namestringyes
expressionstringyes
verbose_namestringno
descriptionstringno

Response 200 (application/json): DatasetDetailDto

FieldTypeRequiredDescription
idstringyes
namestringyes
descriptionstringyes
database_idstringyes
kindstringyes
catalogstring, nullableno
schemastring, nullableno
tablestring, nullableno
sqlstring, nullableno
updated_atstring (date-time)yes
columnsDatasetColumnDto[]yes
metricsMetricDto[]yes
certifiedbooleanyesCertified as a trusted/official dataset.
certified_bystringyes
certification_detailsstringyes
StatusMeaning
200Calculated column added (expression validated)
400Invalid column expression
401Not authenticated
403Missing dataset:manage permission, or not the dataset owner
404No such dataset in this workspace
500Internal error

PUT /api/ws/{workspace}/datasets/{id}/columns/{column_name}​

Operation id: ds_update_column. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:manage permission, or not the dataset owner.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
column_namepathstringyesColumn name
workspacepathstringyes

Request body (application/json): UpdateColumnBody

FieldTypeRequiredDescription
verbose_namestring, nullableno
descriptionstring, nullableno
expressionstring, nullableno
groupbyboolean, nullableno
filterableboolean, nullableno
is_temporalboolean, nullableno
formatstring, nullableno
semantic_type"" / "category" / "country" / "currency" / "email" / "url" / "image" / "latitude" / "longitude" / null, nullablenoSemantic role driving smart rendering and chart defaults; "" = none. Rejected with 400 if not one of the listed values.

Response 200 (application/json): DatasetDetailDto

FieldTypeRequiredDescription
idstringyes
namestringyes
descriptionstringyes
database_idstringyes
kindstringyes
catalogstring, nullableno
schemastring, nullableno
tablestring, nullableno
sqlstring, nullableno
updated_atstring (date-time)yes
columnsDatasetColumnDto[]yes
metricsMetricDto[]yes
certifiedbooleanyesCertified as a trusted/official dataset.
certified_bystringyes
certification_detailsstringyes
StatusMeaning
200Column updated
400Cannot set an expression on a physical column, or invalid expression
401Not authenticated
403Missing dataset:manage permission, or not the dataset owner
404No such dataset or column in this workspace
500Internal error

DELETE /api/ws/{workspace}/datasets/{id}/columns/{column_name}​

Operation id: ds_delete_column. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:manage permission, or not the dataset owner.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
column_namepathstringyesCalculated column name
workspacepathstringyes

Response 200 (application/json): DatasetDetailDto

FieldTypeRequiredDescription
idstringyes
namestringyes
descriptionstringyes
database_idstringyes
kindstringyes
catalogstring, nullableno
schemastring, nullableno
tablestring, nullableno
sqlstring, nullableno
updated_atstring (date-time)yes
columnsDatasetColumnDto[]yes
metricsMetricDto[]yes
certifiedbooleanyesCertified as a trusted/official dataset.
certified_bystringyes
certification_detailsstringyes
StatusMeaning
200Calculated column deleted
401Not authenticated
403Missing dataset:manage permission, or not the dataset owner
404No such dataset in this workspace
500Internal error

POST /api/ws/{workspace}/datasets/{id}/data​

Operation id: ds_data. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): No dataset:read grant on this dataset.

Object-scoped dataset data-preview: runs ONLY a bounded SELECT * FROM <the dataset's own source> LIMIT n (n from the optional body, clamped to [100, 1000]). Accepts NO client SQL, so an object guest with a dataset:read grant can preview only the shared dataset — no query:run workspace permission required.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Request body (application/json): DatasetDataBody

FieldTypeRequiredDescription
limitinteger (int64), nullablenoRows to preview. Clamped to [100, 1000]; defaults to 200 when absent.

Response 200 (application/json): ChartRunResponse

FieldTypeRequiredDescription
columnsColumnMeta[]yes
rowsobject[][]yesRow-major cell values; each inner vec is one row aligned to columns.
StatusMeaning
200A bounded preview of the dataset's OWN source (SELECT * … LIMIT n): columns + rows
400Malformed request body
401Not authenticated
403No dataset:read grant on this dataset
404No such dataset in this workspace
500Internal error
502Query engine error

PATCH /api/ws/{workspace}/datasets/{id}/folder​

Operation id: ds_set_folder. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:manage permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Request body (application/json): SetFolder

FieldTypeRequiredDescription
folder_idstring (uuid), nullableno

Response 200 (application/json): Ack

FieldTypeRequiredDescription
okbooleanyes
StatusMeaning
200Dataset moved to folder
401Not authenticated
403Missing dataset:manage permission
404No such dataset or target folder in this workspace
500Internal error

POST /api/ws/{workspace}/datasets/{id}/metrics​

Operation id: ds_add_metric. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:manage permission, or not the dataset owner.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Request body (application/json): MetricBody

FieldTypeRequiredDescription
metric_namestringyes
expressionstringyes
verbose_namestringno
descriptionstringno
formatstringno

Response 200 (application/json): DatasetDetailDto

FieldTypeRequiredDescription
idstringyes
namestringyes
descriptionstringyes
database_idstringyes
kindstringyes
catalogstring, nullableno
schemastring, nullableno
tablestring, nullableno
sqlstring, nullableno
updated_atstring (date-time)yes
columnsDatasetColumnDto[]yes
metricsMetricDto[]yes
certifiedbooleanyesCertified as a trusted/official dataset.
certified_bystringyes
certification_detailsstringyes
StatusMeaning
200Metric added (expression validated)
400Invalid metric expression
401Not authenticated
403Missing dataset:manage permission, or not the dataset owner
404No such dataset in this workspace
500Internal error

PUT /api/ws/{workspace}/datasets/{id}/metrics/{metric_id}​

Operation id: ds_update_metric. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:manage permission, or not the dataset owner.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
metric_idpathstring (uuid)yesMetric id
workspacepathstringyes

Request body (application/json): MetricBody

FieldTypeRequiredDescription
metric_namestringyes
expressionstringyes
verbose_namestringno
descriptionstringno
formatstringno

Response 200 (application/json): DatasetDetailDto

FieldTypeRequiredDescription
idstringyes
namestringyes
descriptionstringyes
database_idstringyes
kindstringyes
catalogstring, nullableno
schemastring, nullableno
tablestring, nullableno
sqlstring, nullableno
updated_atstring (date-time)yes
columnsDatasetColumnDto[]yes
metricsMetricDto[]yes
certifiedbooleanyesCertified as a trusted/official dataset.
certified_bystringyes
certification_detailsstringyes
StatusMeaning
200Metric updated (expression validated)
400Invalid metric expression
401Not authenticated
403Missing dataset:manage permission, or not the dataset owner
404No such dataset, or metric not in this dataset
500Internal error

DELETE /api/ws/{workspace}/datasets/{id}/metrics/{metric_id}​

Operation id: ds_delete_metric. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:manage permission, or not the dataset owner.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
metric_idpathstring (uuid)yesMetric id
workspacepathstringyes

Response 200 (application/json): DatasetDetailDto

FieldTypeRequiredDescription
idstringyes
namestringyes
descriptionstringyes
database_idstringyes
kindstringyes
catalogstring, nullableno
schemastring, nullableno
tablestring, nullableno
sqlstring, nullableno
updated_atstring (date-time)yes
columnsDatasetColumnDto[]yes
metricsMetricDto[]yes
certifiedbooleanyesCertified as a trusted/official dataset.
certified_bystringyes
certification_detailsstringyes
StatusMeaning
200Metric deleted
401Not authenticated
403Missing dataset:manage permission, or not the dataset owner
404No such dataset, or metric not in this dataset
500Internal error

PUT /api/ws/{workspace}/datasets/{id}/metrics/{metric_id}/certification​

Operation id: ds_set_metric_certification. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:certify permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
metric_idpathstring (uuid)yesMetric id
workspacepathstringyes

Request body (application/json): SetDatasetCertification

FieldTypeRequiredDescription
certifiedbooleanyes
detailsstringnoIgnored when certified is false — withdrawing clears the note rather than leaving a stale justification attached to an uncertified dataset.

Response 200 (application/json): DatasetDetailDto

FieldTypeRequiredDescription
idstringyes
namestringyes
descriptionstringyes
database_idstringyes
kindstringyes
catalogstring, nullableno
schemastring, nullableno
tablestring, nullableno
sqlstring, nullableno
updated_atstring (date-time)yes
columnsDatasetColumnDto[]yes
metricsMetricDto[]yes
certifiedbooleanyesCertified as a trusted/official dataset.
certified_bystringyes
certification_detailsstringyes
StatusMeaning
200Certification set
401Not authenticated
403Missing dataset:certify permission
404No such dataset or metric
500Internal error

POST /api/ws/{workspace}/datasets/{id}/refresh​

Operation id: ds_refresh. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:manage permission, or not the dataset owner.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Response 200 (application/json): DatasetDetailDto

FieldTypeRequiredDescription
idstringyes
namestringyes
descriptionstringyes
database_idstringyes
kindstringyes
catalogstring, nullableno
schemastring, nullableno
tablestring, nullableno
sqlstring, nullableno
updated_atstring (date-time)yes
columnsDatasetColumnDto[]yes
metricsMetricDto[]yes
certifiedbooleanyesCertified as a trusted/official dataset.
certified_bystringyes
certification_detailsstringyes
StatusMeaning
200Physical columns reconciled from the source
401Not authenticated
403Missing dataset:manage permission, or not the dataset owner
404No such dataset in this workspace
500Internal error

POST /api/ws/{workspace}/datasets/{id}/restore​

Operation id: ds_restore. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:manage permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Response 200 (application/json): Ack

FieldTypeRequiredDescription
okbooleanyes
StatusMeaning
200Dataset restored from trash
401Not authenticated
403Missing dataset:manage permission
404No such dataset in this workspace
500Internal error

POST /api/ws/{workspace}/datasets/{id}/trash​

Operation id: ds_trash. Auth: Session cookie and X-Egret-CSRF header. Forbidden (403): Missing dataset:manage permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Response 200 (application/json): Ack

FieldTypeRequiredDescription
okbooleanyes
StatusMeaning
200Dataset moved to trash
401Not authenticated
403Missing dataset:manage permission
404No such dataset in this workspace
500Internal error

GET /api/ws/{workspace}/datasets/{id}/usage​

Operation id: ds_usage. Auth: Session cookie. Forbidden (403): Missing dataset:read permission.

ParameterInTypeRequiredDescription
workspacepathstringyesWorkspace slug
idpathstring (uuid)yesDataset id
workspacepathstringyes

Response 200 (application/json): array of DatasetUsageDto

FieldTypeRequiredDescription
idstringyes
namestringyes
StatusMeaning
200Charts that use this dataset
403Missing dataset:read permission
404No such dataset in this workspace