a6eebb940f
* feat: improve code * feat: update docs * feat: update docs * Update index.md * Update features.md * Update when.md * Update contributing.md * Update translations.md * feat: clean up * Add files via upload * Update the-first-app.md * Update plugins.md * Update a-b-c.md * Update blocks.md * feat: update docs * Add files via upload * Update charts.md * feat: update navs * Update index.md * Update index.md * Update features.md * Update index.md * Update docker-compose.md * Update create-nocobase-app.md * Update git-clone.md * Update contributing.md * Update translations.md * Update plugins.md * Update the-first-app.md * Add files via upload * Update charts.md * Update charts.md * Update a-b-c.md * Update collections.md * Update menus.md * Update menus.md Co-authored-by: Zhou <zhou.working@gmail.com>
1.7 KiB
1.7 KiB
Action API
Common
Collection 和 Association 资源通用。
create
POST /api/users:create?whitelist=a,b&blacklist=c,d
{} # Request Body
- Parameters
- whitelist 白名单
- blacklist 黑名单
- Request body: 待插入的 JSON 数据
- Response body data: 已创建的数据 JSON
新增用户
POST /api/users:create
Request Body
{
"email": "demo@nocobase.com",
"name": "Admin"
}
Response 200 (application/json)
{
"data": {},
}
新增用户文章
POST /api/users/1/posts:create
Request Body
{
"title": "My first post"
}
Response 200 (application/json)
{
"data": {}
}
Request Body 里的 association
POST /api/posts:create
Request Body
{
"title": "My first post",
"user": 1
}
Response 200 (application/json)
{
"data": {
"id": 1,
"title": "My first post",
"userId": 1,
"user": {
"id": 1
}
}
}
update
POST /api/users:create?filterByTk=1&whitelist=a,b&blacklist=c,d
{} # Request Body
- Parameters
- whitelist 白名单
- blacklist 黑名单
- filterByTk 根据 tk 字段过滤,默认情况 tk 为数据表的主键
- filter 过滤,支持 json string
- Request body: 待更新的 JSON 数据
Request Body 里的 association
POST /api/posts:update/1
Request Body
{
"title": "My first post 2",
"user": 2
}
Response 200 (application/json)
{
"data": [
{
"id": 1,
"title": "My first post 2",
"userId": 2,
"user": {
"id": 2
}
}
]
}