tachybase_todo/docs/zh-CN/api/http-api/action-api.md
Junyi 796e73ae5a
refactor(doc): change to new structure (#804)
* refactor(doc): change to new structure

* docs: add database docs

* docs: add collection docs

* docs: add db field examples

* docs(api): fix filename and menu path

* docs: add database docs

* docs: add db operators doc

* docs: add resourcer menu

* docs: add resourcer docs

* docs: fix api docs

* docs: refactor api menu structure

* feat: update docs (#830)

* feat: updates

* feat: update docs

* chore: ignore docs from ci

Co-authored-by: Junyi <mytharcher@users.noreply.github.com>
Co-authored-by: mytharcher <mytharcher@gmail.com>

* docs: add database methods docs

* docs: add missed api

* docs: fix api docs

* feat: update development docs (#833)

* feat: update development docs

* feat: update docs

* feat: update docs

* docs: add first plugin example (#834)

* feat: update docs

* feat: update docs

* docs: fix typo

Co-authored-by: chenos <chenlinxh@gmail.com>
2022-09-19 09:23:01 +08:00

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
      }
    }
  ]
}

list

get

destroy

move

Association


add

set

remove

toggle