server-api

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Steedos Server API | Steedos 服务端 API

Steedos 服务端 API

Overview | 概述

概述

The Steedos Server exposes REST APIs under the
/api/v6/
namespace. All data/object/function endpoints require authentication via
AuthGuard
.
Steedos 服务端在
/api/v6/
命名空间下提供 REST API。所有数据/对象/函数端点需要身份认证。
Steedos 服务端在
/api/v6/
命名空间下提供 REST API。所有数据/对象/函数端点需要通过
AuthGuard
进行身份认证。
Steedos 服务端在
/api/v6/
命名空间下提供 REST API。所有数据/对象/函数端点需要身份认证。

Authentication | 认证

认证

All protected endpoints use cookie-based authentication:
  • Cookies:
    X-Space-Id
    (tenant ID) +
    X-Auth-Token
    (auth token)
  • Bearer Token:
    Authorization: Bearer <token>
    (Swagger/API calls)
The server extracts user context as:
{ user: userId, space: spaceId }
.
所有受保护的端点使用基于Cookie的身份认证:
  • Cookies
    X-Space-Id
    (租户ID) +
    X-Auth-Token
    (认证令牌)
  • Bearer Token
    Authorization: Bearer <token>
    (Swagger/API调用时使用)
服务端提取的用户上下文为:
{ user: userId, space: spaceId }

Swagger / OpenAPI

Swagger / OpenAPI

  • Swagger UI:
    GET /api/v6
  • OpenAPI JSON:
    GET /api/v6-json
API Tags: Auth, Users, Records, Mongodb, Files, Rooms, Tables, Pages, Services, Email, Docs, Automation, Oidc, App
  • Swagger UI
    GET /api/v6
  • OpenAPI JSON
    GET /api/v6-json
API 标签:Auth、Users、Records、Mongodb、Files、Rooms、Tables、Pages、Services、Email、Docs、Automation、Oidc、App

Data API —
/api/v6/data
| 数据 API

数据 API —
/api/v6/data

CRUD operations for any object's records. All endpoints are under
@UseGuards(AuthGuard)
.
用于对任意对象的记录执行CRUD操作。所有端点均受
@UseGuards(AuthGuard)
保护。

Create Record | 创建记录

创建记录

POST /api/v6/data/:objectName
Body: Record JSON object. You can specify
_id
or it will be auto-generated.
Auto-generated fields:
created
,
created_by
,
modified
,
modified_by
,
space
,
owner
Response:
200
— The created record with all auto-generated fields.
json
// Request
POST /api/v6/data/orders
{ "customer": "acme_corp", "total_amount": 5000 }

// Response
{
  "_id": "f5e2b3c4-...",
  "customer": "acme_corp",
  "total_amount": 5000,
  "created": "2026-04-18T...",
  "created_by": "user_id",
  "modified": "2026-04-18T...",
  "modified_by": "user_id",
  "owner": "user_id",
  "space": "tenant_id"
}
POST /api/v6/data/:objectName
请求体:记录的JSON对象。您可以指定
_id
,否则系统将自动生成。
自动生成字段
created
created_by
modified
modified_by
space
owner
响应
200
— 包含所有自动生成字段的已创建记录。
json
// 请求
POST /api/v6/data/orders
{ "customer": "acme_corp", "total_amount": 5000 }

// 响应
{
  "_id": "f5e2b3c4-...",
  "customer": "acme_corp",
  "total_amount": 5000,
  "created": "2026-04-18T...",
  "created_by": "user_id",
  "modified": "2026-04-18T...",
  "modified_by": "user_id",
  "owner": "user_id",
  "space": "tenant_id"
}

List Records | 查询记录列表

查询记录列表

GET /api/v6/data/:objectName
Query Parameters:
ParameterTypeDefaultDescription
fields
stringallComma-separated or JSON array:
"name,created"
or
["name","created"]
filters
string (JSON)noneFilter criteria:
["status","=","active"]
sort
stringnoneSort string:
"name asc, created desc"
skip
number0Pagination offset
top
number100Records per page
Response:
json
{
  "data": [...],
  "totalCount": 42
}
GET /api/v6/data/:objectName
查询参数:
参数类型默认值描述
fields
string全部逗号分隔或JSON数组:
"name,created"
["name","created"]
filters
string (JSON)筛选条件:
["status","=","active"]
sort
string排序字符串:
"name asc, created desc"
skip
number0分页偏移量
top
number100每页记录数
响应:
json
{
  "data": [...],
  "totalCount": 42
}

Get Single Record | 获取单条记录

获取单条记录

GET /api/v6/data/:objectName/:recordId
Response:
200
— The record object.
404
if not found.
GET /api/v6/data/:objectName/:recordId
响应
200
— 记录对象。若未找到则返回
404

Update Record | 更新记录

更新记录

PATCH /api/v6/data/:objectName/:id
Body: Partial record with fields to update.
Response:
200
— The updated record.
404
if not found.
PATCH /api/v6/data/:objectName/:id
请求体:包含待更新字段的部分记录对象。
响应
200
— 更新后的记录。若未找到则返回
404

Delete Record | 删除记录

删除记录

DELETE /api/v6/data/:objectName/:id
Response:
200
{ "deleted": true, "_id": "..." }
.
404
if not found.
DELETE /api/v6/data/:objectName/:id
响应
200
{ "deleted": true, "_id": "..." }
。若未找到则返回
404

Filter Operators | 筛选运算符

筛选运算符

OperatorDescription
=
Equal
<>
Not equal
<
Less than
>
Greater than
<=
Less than or equal
>=
Greater than or equal
startsWith
Starts with (strings)
endswith
Ends with (strings)
contains
Contains (strings)
notcontains
Does not contain (strings)
运算符描述
=
等于
<>
不等于
<
小于
>
大于
<=
小于等于
>=
大于等于
startsWith
以指定字符串开头(仅适用于字符串)
endswith
以指定字符串结尾(仅适用于字符串)
contains
包含指定字符串(仅适用于字符串)
notcontains
不包含指定字符串(仅适用于字符串)

Complex Filters | 复合筛选

复合筛选

json
// AND
[["status", "=", "active"], "and", ["amount", ">", 1000]]

// OR
[["status", "=", "active"], "or", ["status", "=", "pending"]]

// Nested
[["field", "=", 10], "and", [["other", "<", 3], "or", ["other", ">", 11]]]
json
// 逻辑与
[["status", "=", "active"], "and", ["amount", ">", 1000]]

// 逻辑或
[["status", "=", "active"], "or", ["status", "=", "pending"]]

// 嵌套筛选
[["field", "=", 10], "and", [["other", "<", 3], "or", ["other", ">", 11]]]

Objects API —
/api/v6/objects
| 对象元数据 API

对象元数据 API —
/api/v6/objects

Get Object Configuration | 获取对象配置

获取对象配置

GET /api/v6/objects/:objectApiName
Returns the full object schema (fields, listviews, permissions, etc.).
GET /api/v6/objects/:objectApiName
返回完整的对象 schema(字段、列表视图、权限等)。

Get Simplified Object | 获取简化对象

获取简化对象

GET /api/v6/objects/:objectApiName/simplified
Returns only
name
,
label
, and non-hidden fields (with
label
,
type
,
name
per field).
GET /api/v6/objects/:objectApiName/simplified
仅返回
name
label
以及非隐藏字段(每个字段包含
label
type
name
)。

Functions API —
/api/v6/functions
| 函数执行 API

函数执行 API —
/api/v6/functions

Execute Function (GET) | 执行函数 (GET)

执行函数 (GET)

GET /api/v6/functions/:objectApiName/:functionApiName?param1=value1
Query parameters are passed to the function as
ctx.input
.
GET /api/v6/functions/:objectApiName/:functionApiName?param1=value1
查询参数将作为
ctx.input
传递给函数。

Execute Function (POST) | 执行函数 (POST)

执行函数 (POST)

POST /api/v6/functions/:objectApiName/:functionApiName
Body: JSON object passed to the function as
ctx.input
.
Both methods merge
objectName
and
functionApiName
into the parameters:
javascript
// Inside the function handler, ctx.input contains:
{
  objectName: "orders",
  functionApiName: "approve_order",
  ...bodyOrQueryParams
}
POST /api/v6/functions/:objectApiName/:functionApiName
请求体:JSON对象,将作为
ctx.input
传递给函数。
两种方式都会将
objectName
functionApiName
合并到参数中:
javascript
// 在函数处理器内部,ctx.input包含以下内容:
{
  objectName: "orders",
  functionApiName: "approve_order",
  ...bodyOrQueryParams
}

File Upload API | 文件上传 API

文件上传 API

POST /api/instance/:instanceId/file
Multipart form data with field name
file
. Uses
FileInterceptor
.
POST /api/instance/:instanceId/file
使用字段名为
file
的多部分表单数据,采用
FileInterceptor
处理。

App / Health Endpoints | 应用/健康端点

应用/健康端点

EndpointMethodDescription
/api/v6/amis/public_settings
GETReturns public env settings, asset URLs, server status
/api/health_check
GETReturns
{ status: "ok" }
/api/v6/amis/health_check
GET/POSTReturns
{ status: 0, data: {} }
(Amis format)
端点请求方法描述
/api/v6/amis/public_settings
GET返回公共环境设置、资源URL、服务状态
/api/health_check
GET返回
{ status: "ok" }
/api/v6/amis/health_check
GET/POST返回
{ status: 0, data: {} }
(Amis格式)

Public Settings Response | 公共设置响应

公共设置响应

json
{
  "rootUrl": "https://example.com",
  "assetUrls": ["...assets.json", "...assets.json"],
  "unpkgUrl": "/unpkg",
  "serverStatus": "running",
  "steedosVersion": "3.0.13",
  "steedosAmisVersion": "6.3.0-patch.8",
  "PUBLIC_SETTINGS": { ... }
}
json
{
  "rootUrl": "https://example.com",
  "assetUrls": ["...assets.json", "...assets.json"],
  "unpkgUrl": "/unpkg",
  "serverStatus": "running",
  "steedosVersion": "3.0.13",
  "steedosAmisVersion": "6.3.0-patch.8",
  "PUBLIC_SETTINGS": { ... }
}