mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 04:49:41 -05:00
Expose the iCalendar (.ics) import as a REST endpoint
POST /api/boards/:boardId/swimlanes/:swimlaneId/lists/:listId/ics (body { ics })
that reuses the shared import logic, requires board write access, and returns
{ created, cardIds }. Document it in the OpenAPI spec (openapi/extra_paths.yml,
spliced into public/api/wekan.yml) and add an 'importics' example command to
api.py. Note the new endpoint in the ChangeLog.
Note: OAUTH2_LOGOUT_ENDPOINT (the only new env var in the Upcoming changelog) is
already present in all deployment configs (Dockerfile, docker-compose.yml,
snap-src/bin/config, start-wekan.sh/.bat); rebuild-wekan.sh/.bat are dev-run
scripts with no OAUTH2 section, so nothing was added there.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
642 lines
22 KiB
YAML
642 lines
22 KiB
YAML
# ───────────────────────────────────────────────────────────────────────────
|
|
# Attachment / file API (server/routes/attachmentApi.js)
|
|
#
|
|
# These endpoints are registered with `WebApp.handlers.use('/api/attachment/...')`
|
|
# rather than the `WebApp.handlers.get/post/put/delete(...)` form, so they are
|
|
# not auto-discovered by openapi/generate_openapi.py and are documented here by
|
|
# hand. Keep this file in sync with server/routes/attachmentApi.js.
|
|
#
|
|
# Authentication: send the login token in the `Authorization: Bearer <token>`
|
|
# header (same UserSecurity scheme as the rest of the API). The legacy
|
|
# `X-User-Id` + `X-Auth-Token` header pair is also accepted.
|
|
#
|
|
# Permissions: read operations (download, list, info) require active membership
|
|
# of the board. Write operations (upload, copy, move, delete) require write
|
|
# access to the board — active members who are read-only, comment-only,
|
|
# no-comments, worker or assigned-only are rejected; global site admins are
|
|
# always allowed. Upload/copy additionally require the board to allow
|
|
# attachments, and honour the admin API transfer limits (apiUpload*/apiDownload*).
|
|
# ───────────────────────────────────────────────────────────────────────────
|
|
/api/attachment/upload:
|
|
post:
|
|
operationId: upload_attachment
|
|
summary: Upload a file as a card attachment
|
|
description: |
|
|
Upload a file to a card. The file content is sent base64-encoded in the
|
|
JSON body. The maximum size is bounded by the admin Attachment Storage
|
|
Settings (`apiUploadMaxBytes`) and a hard server safety cap (64 MB).
|
|
|
|
Permissions: requires a valid auth token, write access to the target
|
|
board (read-only / comment-only / worker members are rejected), and the
|
|
board must allow attachments.
|
|
consumes:
|
|
- application/json
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Attachments
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: body
|
|
in: body
|
|
required: true
|
|
schema:
|
|
type: object
|
|
required:
|
|
- boardId
|
|
- swimlaneId
|
|
- listId
|
|
- cardId
|
|
- fileData
|
|
- fileName
|
|
properties:
|
|
boardId:
|
|
type: string
|
|
description: ID of the board the card belongs to
|
|
swimlaneId:
|
|
type: string
|
|
description: ID of the card's swimlane (must match the card)
|
|
listId:
|
|
type: string
|
|
description: ID of the card's list (must match the card)
|
|
cardId:
|
|
type: string
|
|
description: ID of the card to attach the file to
|
|
fileName:
|
|
type: string
|
|
description: Name to store the file under
|
|
fileType:
|
|
type: string
|
|
description: MIME type of the file (optional)
|
|
fileData:
|
|
type: string
|
|
description: Base64-encoded file contents
|
|
responses:
|
|
'200':
|
|
description: Attachment uploaded successfully
|
|
'400':
|
|
description: Missing/invalid parameters or card/board/list/swimlane mismatch
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'403':
|
|
description: Uploads disabled, not a board member, or attachments not allowed on this board
|
|
'404':
|
|
description: Card or board not found
|
|
'413':
|
|
description: Attachment exceeds the API upload limit
|
|
/api/attachment/upload-background:
|
|
post:
|
|
operationId: upload_board_background
|
|
summary: Upload a board background image
|
|
description: |
|
|
Upload an image and set it as the board's active background. The file
|
|
content is sent base64-encoded in the JSON body and stored using the
|
|
current Admin Panel / Attachments / Default Storage backend (the same
|
|
storage used by card attachment uploads). Board-admin is required.
|
|
consumes:
|
|
- application/json
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Attachments
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: body
|
|
in: body
|
|
required: true
|
|
schema:
|
|
type: object
|
|
required:
|
|
- boardId
|
|
- fileData
|
|
- fileName
|
|
properties:
|
|
boardId:
|
|
type: string
|
|
description: ID of the board
|
|
fileName:
|
|
type: string
|
|
description: Name to store the image under
|
|
fileType:
|
|
type: string
|
|
description: MIME type of the image (optional, defaults to image/png)
|
|
fileData:
|
|
type: string
|
|
description: Base64-encoded image contents
|
|
responses:
|
|
'200':
|
|
description: Background uploaded and set as the board background
|
|
'400':
|
|
description: Missing or invalid parameters
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'403':
|
|
description: Uploads disabled or caller is not a board admin
|
|
'404':
|
|
description: Board not found
|
|
'413':
|
|
description: Background exceeds the API upload limit
|
|
/api/attachment/download-background/{boardId}:
|
|
get:
|
|
operationId: download_board_background
|
|
summary: Download the board's current background image as base64
|
|
description: |
|
|
Returns the board's active background image metadata together with the
|
|
image bytes base64-encoded in `base64Data`. Requires board membership.
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Attachments
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: boardId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
description: ID of the board
|
|
responses:
|
|
'200':
|
|
description: Background image returned
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'403':
|
|
description: Downloads disabled or caller is not a board member
|
|
'404':
|
|
description: Board has no background, or board not found
|
|
'413':
|
|
description: Background exceeds the API download limit
|
|
/api/attachment/download/{attachmentId}:
|
|
get:
|
|
operationId: download_attachment
|
|
summary: Download an attachment as base64
|
|
description: |
|
|
Returns the attachment metadata together with the file contents
|
|
base64-encoded in `base64Data`. The maximum size is bounded by the admin
|
|
Attachment Storage Settings (`apiDownloadMaxBytes`).
|
|
|
|
Permissions: requires active membership of the attachment's board.
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Attachments
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: attachmentId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
description: ID of the attachment to download
|
|
responses:
|
|
'200':
|
|
description: Attachment contents returned (base64Data)
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'403':
|
|
description: Downloads disabled, or not a member of the attachment's board
|
|
'404':
|
|
description: Attachment or stored file not found
|
|
'413':
|
|
description: Attachment exceeds the API download limit
|
|
/api/attachment/info/{attachmentId}:
|
|
get:
|
|
operationId: get_attachment_info
|
|
summary: Get attachment metadata
|
|
description: |
|
|
Returns attachment metadata (name, size, type, storage backend, board /
|
|
swimlane / list / card IDs and available versions) without the file
|
|
contents.
|
|
|
|
Permissions: requires active membership of the attachment's board.
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Attachments
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: attachmentId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
description: ID of the attachment
|
|
responses:
|
|
'200':
|
|
description: Attachment metadata returned
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'403':
|
|
description: Not a member of the attachment's board
|
|
'404':
|
|
description: Attachment not found
|
|
/api/attachment/list/{boardId}:
|
|
get:
|
|
operationId: list_board_attachments
|
|
summary: List all attachments of a board
|
|
description: |
|
|
List every attachment on a board. Use the swimlane / list / card
|
|
variants of this path to narrow the result.
|
|
|
|
Permissions: requires active membership of the board.
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Attachments
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: boardId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
description: ID of the board
|
|
responses:
|
|
'200':
|
|
description: List of attachments with metadata
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'403':
|
|
description: Not a member of the board
|
|
/api/attachment/list/{boardId}/{swimlaneId}:
|
|
get:
|
|
operationId: list_swimlane_attachments
|
|
summary: List attachments of a board filtered by swimlane
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Attachments
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: boardId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
- name: swimlaneId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
responses:
|
|
'200':
|
|
description: List of attachments with metadata
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'403':
|
|
description: Not a member of the board
|
|
/api/attachment/list/{boardId}/{swimlaneId}/{listId}:
|
|
get:
|
|
operationId: list_list_attachments
|
|
summary: List attachments of a board filtered by swimlane and list
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Attachments
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: boardId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
- name: swimlaneId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
- name: listId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
responses:
|
|
'200':
|
|
description: List of attachments with metadata
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'403':
|
|
description: Not a member of the board
|
|
/api/attachment/list/{boardId}/{swimlaneId}/{listId}/{cardId}:
|
|
get:
|
|
operationId: list_card_attachments
|
|
summary: List attachments of a single card
|
|
description: |
|
|
List attachments filtered down to one card. The card must belong to the
|
|
given board.
|
|
|
|
Permissions: requires active membership of the board.
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Attachments
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: boardId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
- name: swimlaneId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
- name: listId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
- name: cardId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
responses:
|
|
'200':
|
|
description: List of attachments with metadata
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'403':
|
|
description: Not a member of the board
|
|
'404':
|
|
description: Card not found or does not belong to the board
|
|
/api/attachment/copy:
|
|
post:
|
|
operationId: copy_attachment
|
|
summary: Copy an attachment to another card
|
|
description: |
|
|
Copy an existing attachment to a target card, creating a new attachment.
|
|
|
|
Permissions: requires membership of the source board (to read it) and
|
|
write access to the target board, which must allow attachments. Honours
|
|
the admin API upload limits.
|
|
consumes:
|
|
- application/json
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Attachments
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: body
|
|
in: body
|
|
required: true
|
|
schema:
|
|
type: object
|
|
required:
|
|
- attachmentId
|
|
- targetBoardId
|
|
- targetSwimlaneId
|
|
- targetListId
|
|
- targetCardId
|
|
properties:
|
|
attachmentId:
|
|
type: string
|
|
description: ID of the source attachment
|
|
targetBoardId:
|
|
type: string
|
|
targetSwimlaneId:
|
|
type: string
|
|
targetListId:
|
|
type: string
|
|
targetCardId:
|
|
type: string
|
|
responses:
|
|
'200':
|
|
description: Attachment copied (newAttachmentId returned)
|
|
'400':
|
|
description: Target card/board/list/swimlane mismatch
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'403':
|
|
description: Not a member of source or target board, or attachments not allowed
|
|
'404':
|
|
description: Source attachment, target card, or stored file not found
|
|
/api/attachment/move:
|
|
post:
|
|
operationId: move_attachment
|
|
summary: Move an attachment to another card
|
|
description: |
|
|
Move an existing attachment to a target card by updating its metadata.
|
|
|
|
Permissions: requires write access to both the source board (the
|
|
attachment is removed from it) and the target board, which must allow
|
|
attachments.
|
|
consumes:
|
|
- application/json
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Attachments
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: body
|
|
in: body
|
|
required: true
|
|
schema:
|
|
type: object
|
|
required:
|
|
- attachmentId
|
|
- targetBoardId
|
|
- targetSwimlaneId
|
|
- targetListId
|
|
- targetCardId
|
|
properties:
|
|
attachmentId:
|
|
type: string
|
|
description: ID of the attachment to move
|
|
targetBoardId:
|
|
type: string
|
|
targetSwimlaneId:
|
|
type: string
|
|
targetListId:
|
|
type: string
|
|
targetCardId:
|
|
type: string
|
|
responses:
|
|
'200':
|
|
description: Attachment moved
|
|
'400':
|
|
description: Target card/board/list/swimlane mismatch
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'403':
|
|
description: Not a member of source or target board, or attachments not allowed
|
|
'404':
|
|
description: Source attachment or target card not found
|
|
/api/attachment/delete/{attachmentId}:
|
|
delete:
|
|
operationId: delete_attachment
|
|
summary: Delete an attachment
|
|
description: |
|
|
Delete an attachment.
|
|
|
|
Permissions: requires write access to the attachment's board (read-only /
|
|
comment-only / worker members are rejected).
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Attachments
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: attachmentId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
description: ID of the attachment to delete
|
|
responses:
|
|
'200':
|
|
description: Attachment deleted
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'403':
|
|
description: Not a member of the attachment's board
|
|
'404':
|
|
description: Attachment not found
|
|
|
|
# ───────────────────────────────────────────────────────────────────────────
|
|
# Board card settings (server/models/boards.js)
|
|
#
|
|
# Registered with WebApp.handlers.get/put but the body fields are read in a
|
|
# loop, so they are documented here by hand. Boolean keys are the board card
|
|
# display toggles (allows*). Numeric keys configure card aging (#3984):
|
|
# cardAging (bool) plus cardAgingDays1/2/3 (fade-tier day thresholds).
|
|
# ───────────────────────────────────────────────────────────────────────────
|
|
/api/boards/{boardId}/cardSettings:
|
|
get:
|
|
operationId: get_board_card_settings
|
|
summary: Get a board's card settings (display toggles + card aging)
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Boards
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: boardId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
responses:
|
|
'200':
|
|
description: Card settings returned
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'404':
|
|
description: Board not found
|
|
put:
|
|
operationId: edit_board_card_settings
|
|
summary: Update a board's card settings (display toggles + card aging)
|
|
description: |
|
|
Boolean keys (the allows* display toggles and `cardAging`) accept true/false.
|
|
Numeric keys `cardAgingDays1`, `cardAgingDays2`, `cardAgingDays3` set the
|
|
three card-aging fade-tier day thresholds (default 7 / 14 / 28).
|
|
consumes:
|
|
- application/json
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Boards
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: boardId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
- name: body
|
|
in: body
|
|
required: true
|
|
schema:
|
|
type: object
|
|
properties:
|
|
cardAging:
|
|
type: boolean
|
|
description: Enable visual card aging on the board
|
|
cardAgingDays1:
|
|
type: integer
|
|
description: Idle days for the first (lightest) fade tier
|
|
cardAgingDays2:
|
|
type: integer
|
|
description: Idle days for the second fade tier
|
|
cardAgingDays3:
|
|
type: integer
|
|
description: Idle days for the third (heaviest) fade tier
|
|
responses:
|
|
'200':
|
|
description: Updated card settings returned
|
|
'400':
|
|
description: No recognized card settings in body
|
|
'401':
|
|
description: Missing or invalid authentication
|
|
'404':
|
|
description: Board not found
|
|
|
|
# ───────────────────────────────────────────────────────────────────────────
|
|
# iCalendar (.ics) import (server/methods/icsImport.js)
|
|
#
|
|
# Registered with `WebApp.handlers.post(...)` in server/methods/ which is not
|
|
# one of the directories scanned by openapi/generate_openapi.py, so it is
|
|
# documented here by hand. Keep in sync with server/methods/icsImport.js.
|
|
# See WeKan issue #6323. Import-only; two-way calendar sync is not provided.
|
|
# ───────────────────────────────────────────────────────────────────────────
|
|
/api/boards/{boardId}/swimlanes/{swimlaneId}/lists/{listId}/ics:
|
|
post:
|
|
operationId: import_ics
|
|
summary: Import an iCalendar (.ics) file into a board as cards
|
|
description: |
|
|
Parses the supplied iCalendar text and creates one card per VEVENT on the
|
|
given board / list / swimlane, populating each card's `startAt` (DTSTART)
|
|
and `dueAt` (DTEND, or DTSTART when there is no DTEND) so the imported
|
|
events appear on the Calendar and Gantt views.
|
|
|
|
Permissions: requires a valid auth token and write access to the board
|
|
(read-only / comment-only / worker members are rejected; site admins are
|
|
allowed).
|
|
consumes:
|
|
- application/json
|
|
produces:
|
|
- application/json
|
|
tags:
|
|
- Cards
|
|
security:
|
|
- UserSecurity: []
|
|
parameters:
|
|
- name: boardId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
description: the board ID
|
|
- name: swimlaneId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
description: the swimlane ID the cards are created in
|
|
- name: listId
|
|
in: path
|
|
required: true
|
|
type: string
|
|
description: the list ID the cards are created in
|
|
- name: body
|
|
in: body
|
|
required: true
|
|
schema:
|
|
type: object
|
|
required:
|
|
- ics
|
|
properties:
|
|
ics:
|
|
type: string
|
|
description: the raw .ics (iCalendar) file contents
|
|
responses:
|
|
'200':
|
|
description: |
|
|
Import succeeded. Returns the number of cards created and their ids,
|
|
e.g. `{ "created": 3, "cardIds": ["abc", "def", "ghi"] }`.
|
|
'400':
|
|
description: Missing or empty `ics` body field
|
|
'401':
|
|
description: Missing or invalid authentication, or no write access to the board
|
|
'404':
|
|
description: Board, list or swimlane not found
|