Role in the system
A metadata entry describes one table or entity and defines table name, key field, default sort, searchable fields, select fields, and creation behavior.
Main fields
- table_name: logical resource name used in APIs.
- table_key: primary key column for CRUD operations.
- select_fields and search_fields: base fields used for list and filtering.
- order_by: default sorting expression.
- api_protected and username_field: ownership-aware protection controls.
Ownership protection
When api_protected=true, the API enforces ownership using username_field and the authenticated principal from the token.
- POST and PUT force owner value for non-admin or non-manager users.
- GET list and GET by id filter by owner for non-admin or non-manager users.
- DELETE allows non-admin or non-manager users only on owned records.
Metadata endpoints
GET /api/metadatas
GET /api/metadatas/{uuid}
POST /api/metadatas
PUT /api/metadatas/{uuid}
DELETE /api/metadatas/{uuid}
Related endpoints
GET /api/datalist/metadata/{name}
GET /api/datalist/metadata/{name}/fielddefinitions
Recommended workflow
Create metadata first, then complete form and SQL behavior through field definitions. Keep table_key aligned across both models.