mirror of
https://github.com/wekan/wekan.git
synced 2026-02-18 05:58:07 +01:00
Updated REST API Boards (markdown)
parent
58c9f579ac
commit
832fbac20c
1 changed files with 45 additions and 3 deletions
|
|
@ -18,8 +18,50 @@ curl -H "Authorization: Bearer t7iYB86mXoLfP_XsMegxF41oKT7iiA9lDYiKVtXcctl" \
|
|||
-d '{ "action": "takeOwnership" }'
|
||||
```
|
||||
|
||||
## Board colors
|
||||
## Create board
|
||||
|
||||
Required:
|
||||
- "title":"Board title here"
|
||||
- "owner":"ABCDE12345" <= User ID in Wekan. Not username or email.
|
||||
|
||||
Optional, and defaults:
|
||||
- "isAdmin": "true"
|
||||
- "isActive": "true"
|
||||
- "isNoComments": "false"
|
||||
- "isCommentOnly": "false"
|
||||
- "permission": "private" <== Set to "public" if you want public Wekan board
|
||||
- "color": "belize" <== Board color: belize, nephritis, pomegranate, pumpkin, wisteria, midnight.
|
||||
|
||||
<img src="https://wekan.github.io/board-colors.png" width="30%" alt="Wekan logo" />
|
||||
|
||||
Example:
|
||||
```
|
||||
curl -H "Authorization: Bearer t7iYB86mXoLfP_XsMegxF41oKT7iiA9lDYiKVtXcctl" \
|
||||
-H "Content-type:application/json" \
|
||||
-X POST \
|
||||
http://localhost:3000/api/boards \
|
||||
-d '{"title":"Board title here","owner":"ABCDE12345","permission":"private","color":"nephritis"}'
|
||||
```
|
||||
|
||||
## How REST API is implemented in Wekan code
|
||||
|
||||
wekan/models/boards.js
|
||||
|
||||
<img src="https://wekan.github.io/board-colors.png" width="30%" alt="Wekan logo" />
|
||||
```
|
||||
JsonRoutes.add('POST', '/api/boards', function (req, res) {
|
||||
try {
|
||||
Authentication.checkUserId(req.userId);
|
||||
const id = Boards.insert({
|
||||
title: req.body.title,
|
||||
members: [
|
||||
{
|
||||
userId: req.body.owner,
|
||||
isAdmin: req.body.isAdmin || true,
|
||||
isActive: req.body.isActive || true,
|
||||
isNoComments: req.body.isNoComments || false,
|
||||
isCommentOnly: req.body.isCommentOnly || false,
|
||||
},
|
||||
],
|
||||
permission: req.body.permission || 'private',
|
||||
color: req.body.color || 'belize',
|
||||
});
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue