Labels
The words a board is using.
A label is text on a card, not an entry in a list the board keeps. You put a word on the card it applies to, and the row here exists so that the same word typed on two cards is one thing rather than two — which is what lets a board be filtered by it, and what fills the handful of names offered the next time somebody adds one.
That shape is why this page is short. There is no renaming and no deleting here:
which labels a card wears travels with the card, as labelIds on
PUT /api/data/card, and a word no card wears any longer is removed
on the same request that drops it. Use this endpoint to find out what a board is
already using, and to turn a word into the id the card endpoint wants.
Every label is drawn in the same colour, so there is nothing to set.
GET /api/data/labels
The words in use on a board, in the order they were first used. Needs read access to the board.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
boardId | integer | yes | The board to read. |
What comes back
| Field | Type | Description |
|---|---|---|
labels | array | Each entry an id and a name. |
curl -X GET "https://boards.example.com/api/data/labels?boardId=123" \
-H "X-API-Key: $LOKALBOARDS_KEY"
POST /api/data/labels
A word, in exchange for the label that is that word on this board. If the board
is already using it you get the one it has; if not, one is made. Which of the two
happened is not something you need to know — either way the answer is the id to
put in a card's labelIds. Needs edit access.
Names are compared the way the database compares them, without regard to case,
so Bug and bug are the same label rather than two.
A board is capped at 30 labels in use. Asking for a thirty-first new word answers
400 with TOO_MANY_LABELS; asking for a word already in use always works,
since it adds nothing.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
boardId | integer | yes | The board the word belongs to. |
name | string | yes | The word. Trimmed, and at most 64 characters. |
What comes back
| Field | Type | Description |
|---|---|---|
label | object | The id and name to use. |
# The word, then the card: two requests, because the second one needs the id.
curl -X POST "https://boards.example.com/api/data/labels" \
-H "X-API-Key: $LOKALBOARDS_KEY" \
-H "Content-Type: application/json" \
-d '{ "boardId": 123, "name": "Bug" }'
curl -X PUT "https://boards.example.com/api/data/card" \
-H "X-API-Key: $LOKALBOARDS_KEY" \
-H "Content-Type: application/json" \
-d '{ "cardID": 501, "name": "Ports lassen sich nicht freigeben", "labelIds": [7] }'
Taking a label off a card
There is no endpoint for it here. Send the card the set it should have, without that one:
curl -X PUT "https://boards.example.com/api/data/card" \
-H "X-API-Key: $LOKALBOARDS_KEY" \
-H "Content-Type: application/json" \
-d '{ "cardID": 501, "name": "Ports lassen sich nicht freigeben", "labelIds": [] }'
If that was the last card using the word, the word goes with it and stops being offered. Typing it again makes it again.