Update index.md

This commit is contained in:
Pearl C 2022-12-23 17:53:52 +08:00 committed by GitHub
parent b673cf2ce0
commit 574bac02ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,16 +4,16 @@ HTTP API of NocoBase is designed based on Resource & Action, a superset of REST
## Resource ## Resource
Resource has two expressions in NocoBase: In NocoBase, resource has two expressions:
- `<collection>` - `<collection>`
- `<collection>.<association>` - `<collection>.<association>`
<Alert> <Alert>
- collection is the set of all abstract data - Collection is the set of all abstract data
- association is the associated data of collection - Association is the associated data of collection
- resource includes both collection and collection.association - Resource includes both collection and collection.association
</Alert> </Alert>
@ -25,12 +25,12 @@ Resource has two expressions in NocoBase:
## Action ## Action
Resource action is expressed by `:<action>` Action on resource is expressed by `:<action>`
- `<collection>:<action>` - `<collection>:<action>`
- `<collection>.<association>:<action>` - `<collection>.<association>:<action>`
Built-in global actions for collection or association Built-in global actions for collection or association:
- `create` - `create`
- `get` - `get`
@ -39,7 +39,7 @@ Built-in global actions for collection or association
- `destroy` - `destroy`
- `move` - `move`
Built-in association actions for association only Built-in association actions for association only:
- `set` - `set`
- `add` - `add`
@ -49,8 +49,8 @@ Built-in association actions for association only
### Example ### Example
- `posts:create` Create post - `posts:create` Create post
- `posts.user:get` View post user - `posts.user:get` Get post user
- `posts.tags:add` Attach tags to post (associate existing tags with post) - `posts.tags:add` Add tags to post (associate existing tags with post)
## Request URL ## Request URL
@ -97,10 +97,10 @@ GET /api/posts/1/tags:remove
## Locate Resource ## Locate Resource
- collection resource locates the data to be processed by `collectionIndex`, `collectionIndex` must be unique - Collection resource locates the data to be processed by `collectionIndex`, `collectionIndex` must be unique.
- association resource locates the data to be processed by `collectionIndex` and `associationIndex` jointly, `associationIndex` may not be unique, but the joint index of `collectionIndex` and `associationIndex` must be unique - Association resource locates the data to be processed by `collectionIndex` and `associationIndex` jointly, `associationIndex` may not be unique, but the joint index of `collectionIndex` and `associationIndex` must be unique.
When viewing details of association resource, the requested URL needs to provide both `<collectionIndex>` and `<associationIndex>`, `<collectionIndex>` is needed as `<associationIndex>` may not be unique. When viewing details of association resource, the requested URL needs to provide both `<collectionIndex>` and `<associationIndex>`, `<collectionIndex>` is necessary as `<associationIndex>` may not be unique.
For example, `tables.fields` represents the fields of a data table: For example, `tables.fields` represents the fields of a data table:
@ -231,7 +231,7 @@ POST /api/posts:create?blacklist=date
## Request Response ## Request Response
Format of the response is: Format of the response:
```ts ```ts
type ResponseResult = { type ResponseResult = {