Add new api procedures: getDefaultTaskColor(), getDefaultTaskColors() and getColorList()

This commit is contained in:
Frederic Guillot
2015-07-29 18:45:26 -04:00
parent f595fb2786
commit 2d6b6533ac
5 changed files with 259 additions and 11 deletions

View File

@@ -40,6 +40,8 @@ Almost the same thing as XML-RPC but with the JSON format.
We use the [version 2 of the protocol](http://www.jsonrpc.org/specification).
You must call the API with a `POST` HTTP request.
Kanboard support batch requests, so you can make multiple API calls in a single HTTP request. It's particularly useful for mobile clients with higher network latency.
Authentication
--------------
@@ -295,6 +297,182 @@ Response example:
}
```
### getDefaultTaskColors
- Purpose: **Get all default task colors**
- Parameters: None
- Result on success: **Color properties**
Request example:
```json
{
"jsonrpc": "2.0",
"method": "getDefaultTaskColors",
"id": 2108929212
}
```
Response example:
```json
{
"jsonrpc": "2.0",
"id": 2108929212,
"result": {
"yellow": {
"name": "Yellow",
"background": "rgb(245, 247, 196)",
"border": "rgb(223, 227, 45)"
},
"blue": {
"name": "Blue",
"background": "rgb(219, 235, 255)",
"border": "rgb(168, 207, 255)"
},
"green": {
"name": "Green",
"background": "rgb(189, 244, 203)",
"border": "rgb(74, 227, 113)"
},
"purple": {
"name": "Purple",
"background": "rgb(223, 176, 255)",
"border": "rgb(205, 133, 254)"
},
"red": {
"name": "Red",
"background": "rgb(255, 187, 187)",
"border": "rgb(255, 151, 151)"
},
"orange": {
"name": "Orange",
"background": "rgb(255, 215, 179)",
"border": "rgb(255, 172, 98)"
},
"grey": {
"name": "Grey",
"background": "rgb(238, 238, 238)",
"border": "rgb(204, 204, 204)"
},
"brown": {
"name": "Brown",
"background": "#d7ccc8",
"border": "#4e342e"
},
"deep_orange": {
"name": "Deep Orange",
"background": "#ffab91",
"border": "#e64a19"
},
"dark_grey": {
"name": "Dark Grey",
"background": "#cfd8dc",
"border": "#455a64"
},
"pink": {
"name": "Pink",
"background": "#f48fb1",
"border": "#d81b60"
},
"teal": {
"name": "Teal",
"background": "#80cbc4",
"border": "#00695c"
},
"cyan": {
"name": "Cyan",
"background": "#b2ebf2",
"border": "#00bcd4"
},
"lime": {
"name": "Lime",
"background": "#e6ee9c",
"border": "#afb42b"
},
"light_green": {
"name": "Light Green",
"background": "#dcedc8",
"border": "#689f38"
},
"amber": {
"name": "Amber",
"background": "#ffe082",
"border": "#ffa000"
}
}
}
```
### getDefaultTaskColor
- Purpose: **Get default task color**
- Parameters: None
- Result on success: **color_id**
Request example:
```json
{
"jsonrpc": "2.0",
"method": "getDefaultTaskColor",
"id": 1144775215
}
```
Response example:
```json
{
"jsonrpc": "2.0",
"id": 1144775215,
"result": "yellow"
}
```
### getColorList
- Purpose: **Get the list of task colors**
- Parameters: none
- Result on success: **Dictionary of color_id => color_name**
Request example:
```json
{
"jsonrpc": "2.0",
"method": "getColorList",
"id": 1677051386
}
```
Response example:
```json
{
"jsonrpc": "2.0",
"id": 1677051386,
"result": {
"yellow": "Yellow",
"blue": "Blue",
"green": "Green",
"purple": "Purple",
"red": "Red",
"orange": "Orange",
"grey": "Grey",
"brown": "Brown",
"deep_orange": "Deep Orange",
"dark_grey": "Dark Grey",
"pink": "Pink",
"teal": "Teal",
"cyan": "Cyan",
"lime": "Lime",
"light_green": "Light Green",
"amber": "Amber"
}
}
```
### createProject
- Purpose: **Create a new project**
@@ -2045,7 +2223,12 @@ Response example:
"recurrence_basedate": "0",
"recurrence_parent": null,
"recurrence_child": null,
"url": "http:\/\/127.0.0.1:8000\/?controller=task&action=show&task_id=1&project_id=1"
"url": "http:\/\/127.0.0.1:8000\/?controller=task&action=show&task_id=1&project_id=1",
"color": {
"name": "Yellow",
"background": "rgb(245, 247, 196)",
"border": "rgb(223, 227, 45)"
}
}
}
```