A feature's guide now sits under the menu it is used from, read from the templates rather than from where somebody once put it: Header-Bar, All-Boards, Pages, Board-Header (search and every Board View), Board-Sidebar (Board Settings, Filter, Members, Labels, Archive), Rules, Swimlanes, Lists, Cards, Member-Settings, Admin-Panel and Login-Page. Topics used from several menus (editor, history, theme, translations, email, troubleshooting) are in General. - Each area has a README mapping its menu entries to their guides and to the template or server module that implements them. Board-Header/README.md lists all 40 Board View entries with the template boardBody.jade renders; five views (Table, Calendar Mode, Time, Timeline, Map) have no guide of their own yet and say so. - Board-View.md listed 25 views while BOARD_VIEWS has 40; it now lists all of them with their English labels. - Pages keep their file names. Where a released changelog links an old path, a "# Moved" page stays there and points to the new one; test-menu.sh skips folders holding only those. - Undo was filed under Login; it is General/Undo now. - Every link in docs, code comments, scripts and tests follows the move; docsLinksResolve checks them all. Tests that read a doc follow it to its new place. boardViewSettings now fails when Board-View.md or Board-Header/README.md differs from BOARD_VIEWS, or names a template boardBody.jade does not render. Thanks to xet7 !
4.5 KiB
Optional APIs: Trello, Jira, GitHub and Gitea compatible
Admin Panel → Settings → Visibility → Optional APIs turns on REST APIs in the shape of other trackers' APIs (#4930). An app or script written for Trello, Jira, GitHub or Gitea can then use this WeKan as its backend: what it saves is stored in WeKan's database, on WeKan boards, and is seen in WeKan like any other change.
| Tick | Server address for the client | Signs in with |
|---|---|---|
| Trello-compatible API | https://<wekan>/api/compat/trello (paths /1/...) |
?token=<WeKan token> (?key= is ignored), or Authorization: Bearer / OAuth oauth_token="..." |
| Jira-compatible API | https://<wekan>/api/compat/jira (paths /rest/api/2/...) |
Basic authentication with the WeKan token as the password (any user name), or Bearer |
| GitHub-compatible API | https://<wekan>/api/compat/github |
Authorization: token <WeKan token> or Bearer |
| Gitea-compatible API | https://<wekan>/api/compat/gitea/api/v1 |
Authorization: token <WeKan token>, Bearer, or ?token= |
The token is a WeKan API token: the token from POST /users/login, as in the
REST API.
What they may do: exactly what the person may do
None of these APIs has rights of its own. Each one is a translator: a request in Trello's, Jira's, GitHub's or Gitea's shape becomes the matching request to WeKan's own REST API, made with the caller's own token, and WeKan's answer is turned into the other tracker's JSON. So:
- a client sees only the boards its person may see, and writes only where that person may write: board roles, read-only and comment-only members, assigned-only members, list permissions and every other WeKan permission apply unchanged;
- whatever WeKan's REST API refuses, these APIs refuse;
- WeKan's REST API must be on (
WITH_API=true): with it off, every optional API is off too; - an API that is not ticked answers 404, as if it did not exist.
tests/optionalApis.test.cjs fails if any file of server/compatApi/ writes
to a collection, calls a method, or makes a request anywhere except WeKan's
own REST API on the loopback address.
What maps to what
| Trello | Jira | GitHub, Gitea | |
|---|---|---|---|
| Board | board | project (key = the board key) | repository owner/<board key or id> |
| List | list | status; a transition moves the card | the open / closed list |
| Card | card | issue KEY-7 |
issue #7, open or closed as in Version Control |
| Labels | labels and idLabels |
labels |
labels; a label with a due date is a milestone |
| Comments | commentCard actions |
/issue/{key}/comment |
/issues/{n}/comments |
| Checklists | checklists | - | - |
| Delete | archives the card (restorable) | archives the issue | - |
The endpoints:
- Trello:
members/meand itsboards;boards/{id}, itslists,cards,labelsandmembers;POST boards/{id}/labels;lists/{id}/cards(with?idBoard=),POST listsandPUT lists/{id};GET,POST,PUTandDELETE cards/{id};cards/{id}/actionsandPOST cards/{id}/actions/comments;POSTandDELETE cards/{id}/idLabels;cards/{id}/checklistsandPOST checklists. - Jira:
myself;projectandproject/{key}with itsstatuses;searchby GET or POST with simple JQL (project,status,assignee = currentUser(),text ~,key,AND,ORDER BY created|updated|key);GET,POST,PUTandDELETE issue/{key};issue/{key}/comment;issue/{key}/transitions. JQL WeKan does not answer is an error, not a different answer. - GitHub and Gitea:
user,user/repos;repos/{owner}/{repo}; itsissues(withstate,labels,page,per_page, andLinkandX-Total-Countheaders),POSTan issue,GETandPATCH issues/{n}(title, body, state, labels),issues/{n}/comments,labelsandmilestones. A synced issue is closed in its own tracker.
Files
| File | |
|---|---|
models/lib/optionalApis.js |
The catalog, the switch and each client's way of sending the token |
models/lib/trelloCompatApi.js, jiraCompatApi.js, githubCompatApi.js |
The shapes, both ways. No Meteor code |
server/compatApi/core.js |
The switch, and the calls to WeKan's REST API as the caller |
server/compatApi/trello.js, jira.js, githubLike.js |
The routes |
tests/optionalApis.test.cjs, server/lib/tests/compatApi.tests.js |
The tests; the second over real HTTP |