API

en / cz

General information

API access

This API allows to decorate a christmas tree. Each christmas tree has its unique identifier. The identifier is displayed in the top right corner of the screen. This identifier is necessary to know to invoke any API request.

Base URL:

The application allows either standard HTTP REST API access or also access where all requests are realized using the GET method. This second approach is useful for testing, or just for the purposes of manually triggering the request in a browser. In this case, all parameters needs to be passed using the query string (i.e. get parameters in the url). To invoke an endpoint in this special mode, these conditions needs to be met:

  • only method GET
  • parameter method contains the real method
  • if there is a request body, all parameters from the request body are encoded in the query string

For example, this request:

PUT /QTREIOJV/gifts
with the body:
{
    "color": "green",
    "label": "Jan"
}
may be also invoked as:
GET /QTREIOJV/gifts?method=PUT&color=green&label=Jan

The full url for this example would therefore be:

GET https://vanocnistrom.org/api/QTREIOJV/gifts?method=PUT&color=green&label=Jan

Colors

Anywhere where colors are used, colors may be given in this forms:
  1. as an integer in the range 0 – 15
  2. as a name according to the next table

Colors

0 black black
1 red red
2 green green
3 yellow yellow
4 blue blue
5 magenta magenta
6 cyan cyan
7 gray gray
8 lightgray light gray
9 lightred light red
10 lightgreen light green
11 lightyellow light yellow
12 lightblue light blue
13 lightmagenta light magenta
14 lightcyan light cyan
15 white white
default without color (default color)

Source code

Source code of this application is available on github. It may be used under the terms of the MIT licence.

Star

GET /{tree}/star

Return information about the star on the tree.

Parameters

{tree} - id of the christmas tree

Response body

{
    "exists": true,
    "color": "red"
}

curl

curl https://vanocnistrom.org/api/QTREIOJV/star

test url

https://vanocnistrom.org/api/QTREIOJV/star

PUT /{tree}/star

Decorate the tree with a star.

Parameters

{tree} - id of the christmas tree

Request variables

color - color of the star

Request body

{
    "color": "blue"
}

Response body

{
    "success": true
}

curl

curl -X PUT -d '{"color":"blue"}' https://vanocnistrom.org/api/QTREIOJV/star

test url

https://vanocnistrom.org/api/QTREIOJV/star?method=PUT&color=blue

DELETE /{tree}/star

Remove the star from the tree.

Parameters

{tree} - id of the christmas tree

Response body

{
    "success": true
}

curl

curl -X DELETE https://vanocnistrom.org/api/QTREIOJV/star

test url

https://vanocnistrom.org/api/QTREIOJV/star?method=DELETE

Chains

GET /{tree}/chains

Return information about the whole chain on the tree.

Parameters

{tree} - id of the christmas tree

Response body

[
    {
        "id": 0,
        "exists": true,
        "color": "default"
    },
    {
        "id": 1,
        "exists": true,
        "color": "yellow"
    },
    {
        "id": 2,
        "exists": true,
        "color": "yellow"
    },
    {
        "id": 3,
        "exists": true,
        "color": "yellow"
    },
    {
        "id": 4,
        "exists": true,
        "color": "yellow"
    },
    {
        "id": 5,
        "exists": true,
        "color": "red"
    },
    {
        "id": 6,
        "exists": false
    }
]

curl

curl https://vanocnistrom.org/api/QTREIOJV/chains

test url

https://vanocnistrom.org/api/QTREIOJV/chains

GET /{tree}/chains/{part}

Return information about the chain part on the tree.

Parameters

{tree} - id of the christmas tree
{part} - part number of the chain part

Response body

{
    "id": 2,
    "exists": true,
    "color": "yellow"
}

curl

curl https://vanocnistrom.org/api/QTREIOJV/chains/2

test url

https://vanocnistrom.org/api/QTREIOJV/chains/2

PUT /{tree}/chains

Decorate the tree with a chain (all chain parts at once).

Parameters

{tree} - id of the christmas tree

Request variables

color - color of the chain

Request body

{
    "color": "green"
}

Response body

{
    "success": true
}

curl

curl -X PUT -d '{"color":"green"}' https://vanocnistrom.org/api/QTREIOJV/chains

test url

https://vanocnistrom.org/api/QTREIOJV/chains?method=PUT&color=green

PUT /{tree}/chains/{part}

Decorate the tree with a chain (one single chain part).

Parameters

{tree} - id of the christmas tree
{part} - part number of the chain part

Request variables

color - color of the chain

Request body

{
    "color": "green"
}

Response body

{
    "success": true
}

curl

curl -X PUT -d '{"color":"green"}' https://vanocnistrom.org/api/QTREIOJV/chains/1

test url

https://vanocnistrom.org/api/QTREIOJV/chains/1?method=PUT&color=green

DELETE /{tree}/chains

Remove the whole chain from the tree.

Parameters

{tree} - id of the christmas tree

Response body

{
    "success": true
}

curl

curl -X DELETE https://vanocnistrom.org/api/QTREIOJV/chains

test url

https://vanocnistrom.org/api/QTREIOJV/chains?method=DELETE

DELETE /{tree}/chains/{part}

Remove chain part from the tree.

Parameters

{tree} - id of the christmas tree
{part} - part number of the chain part

Response body

{
    "success": true
}

curl

curl -X DELETE https://vanocnistrom.org/api/QTREIOJV/chains/1

test url

https://vanocnistrom.org/api/QTREIOJV/chains/1?method=DELETE

Glass balls

GET /{tree}/glass-balls

Return information about all glass balls on the tree.

Parameters

{tree} - id of the christmas tree

Response body

[
    {
        "id": 0,
        "exists": true,
        "color": "default"
    },
    {
        "id": 1,
        "exists": true,
        "color": "blue"
    },
    {
        "id": 2,
        "exists": true,
        "color": "blue"
    },
    {
        "id": 3,
        "exists": true,
        "color": "white"
    },
    {
        "id": 4,
        "exists": true,
        "color": "blue"
    },
    {
        "id": 5,
        "exists": true,
        "color": "white"
    },
    {
        "id": 6,
        "exists": true,
        "color": "blue"
    },
    {
        "id": 7,
        "exists": false
    }
]

curl

curl https://vanocnistrom.org/api/QTREIOJV/glass-balls

test url

https://vanocnistrom.org/api/QTREIOJV/glass-balls

GET /{tree}/glass-balls/{part}

Return information about one glass ball on the tree.

Parameters

{tree} - id of the christmas tree
{part} - glass ball part number

Response body

{
    "id": 2,
    "exists": true,
    "color": "yellow"
}

curl

curl https://vanocnistrom.org/api/QTREIOJV/glass-balls/2

test url

https://vanocnistrom.org/api/QTREIOJV/glass-balls/2

PUT /{tree}/glass-balls

Decorate the tree with glass balls (all glass balls at once).

Parameters

{tree} - id of the christmas tree

Request variables

color - color of the glass ball

Request body

{
    "color": "green"
}

Response body

{
    "success": true
}

curl

curl -X PUT -d '{"color":"green"}' https://vanocnistrom.org/api/QTREIOJV/glass-balls

test url

https://vanocnistrom.org/api/QTREIOJV/glass-balls?method=PUT&color=green

PUT /{tree}/glass-balls/{part}

Decorate the tree with one single glass ball.

Parameters

{tree} - id of the christmas tree
{part} - glass ball part number

Request variables

color - color of the glass ball

Request body

{
    "color": "green"
}

Response body

{
    "success": true
}

curl

curl -X PUT -d '{"color":"green"}' https://vanocnistrom.org/api/QTREIOJV/glass-balls/1

test url

https://vanocnistrom.org/api/QTREIOJV/glass-balls/1?method=PUT&color=green

DELETE /{tree}/glass-balls

Remove all glass balls from the tree.

Parameters

{tree} - id of the christmas tree

Response body

{
    "success": true
}

curl

curl -X DELETE https://vanocnistrom.org/api/QTREIOJV/glass-balls

test url

https://vanocnistrom.org/api/QTREIOJV/glass-balls?method=DELETE

DELETE /{tree}/glass-balls/{part}

Remove one glass ball from the tree.

Parameters

{tree} - id of the christmas tree
{part} - glass ball part number

Response body

{
    "success": true
}

curl

curl -X DELETE https://vanocnistrom.org/api/QTREIOJV/glass-balls/1

test url

https://vanocnistrom.org/api/QTREIOJV/glass-balls/1?method=DELETE

Sweets

GET /{tree}/sweets

Return information about all sweets on the tree.

Parameters

{tree} - id of the christmas tree

Response body

[
    {
        "id": 0,
        "exists": true,
        "color": "default"
    },
    {
        "id": 1,
        "exists": true,
        "color": "blue"
    },
    {
        "id": 2,
        "exists": true,
        "color": "blue"
    },
    {
        "id": 3,
        "exists": true,
        "color": "white"
    },
    {
        "id": 4,
        "exists": true,
        "color": "blue"
    },
    {
        "id": 5,
        "exists": true,
        "color": "white"
    },
    {
        "id": 6,
        "exists": true,
        "color": "blue"
    },
    {
        "id": 7,
        "exists": false
    }
]

curl

curl https://vanocnistrom.org/api/QTREIOJV/sweets

test url

https://vanocnistrom.org/api/QTREIOJV/sweets

GET /{tree}/sweets/{part}

Return information about one sweet on the tree.

Parameters

{tree} - id of the christmas tree
{part} - part nubmer of the sweet

Response body

{
    "id": 2,
    "exists": true,
    "color": "yellow"
}

curl

curl https://vanocnistrom.org/api/QTREIOJV/sweets/2

test url

https://vanocnistrom.org/api/QTREIOJV/sweets/2

PUT /{tree}/sweets

Decorate the tree with sweets (all sweets at once).

Parameters

{tree} - id of the christmas tree

Request variables

color - color of the sweet

Request body

{
    "color": "green"
}

Response body

{
    "success": true
}

curl

curl -X PUT -d '{"color":"green"}' https://vanocnistrom.org/api/QTREIOJV/sweets

test url

https://vanocnistrom.org/api/QTREIOJV/sweets?method=PUT&color=green

PUT /{tree}/sweets/{part}

Decorate the tree with one single sweet.

Parameters

{tree} - id of the christmas tree
{part} - part nubmer of the sweet

Request variables

color - color of the sweet

Request body

{
    "color": "green"
}

Response body

{
    "success": true
}

curl

curl -X PUT -d '{"color":"green"}' https://vanocnistrom.org/api/QTREIOJV/sweets/1

test url

https://vanocnistrom.org/api/QTREIOJV/sweets/1?method=PUT&color=green

DELETE /{tree}/sweets

Remove all sweets from the tree.

Parameters

{tree} - id of the christmas tree

Response body

{
    "success": true
}

curl

curl -X DELETE https://vanocnistrom.org/api/QTREIOJV/sweets

test url

https://vanocnistrom.org/api/QTREIOJV/sweets?method=DELETE

DELETE /{tree}/sweets/{part}

Remove one sweet from the tree.

Parameters

{tree} - id of the christmas tree
{part} - part nubmer of the sweet

Response body

{
    "success": true
}

curl

curl -X DELETE https://vanocnistrom.org/api/QTREIOJV/sweets/1

test url

https://vanocnistrom.org/api/QTREIOJV/sweets/1?method=DELETE

Lamps

GET /{tree}/lamps

Return information about all lamps on the tree.

Parameters

{tree} - id of the christmas tree

Response body

[
    {
        "id": 0,
        "exists": true,
        "color": "default"
    },
    {
        "id": 1,
        "exists": true,
        "color": "blue"
    },
    {
        "id": 2,
        "exists": true,
        "color": "blue"
    },
    {
        "id": 3,
        "exists": true,
        "color": "white"
    },
    {
        "id": 4,
        "exists": true,
        "color": "blue"
    },
    {
        "id": 5,
        "exists": false
    }
]

curl

curl https://vanocnistrom.org/api/QTREIOJV/lamps

test url

https://vanocnistrom.org/api/QTREIOJV/lamps

GET /{tree}/lamps/{part}

Return information about one lamp pair on the tree.

Parameters

{tree} - id of the christmas tree
{part} - part number of the lamp pair

Response body

{
    "id": 2,
    "exists": true,
    "color": "yellow"
}

curl

curl https://vanocnistrom.org/api/QTREIOJV/lamps/2

test url

https://vanocnistrom.org/api/QTREIOJV/lamps/2

PUT /{tree}/lamps

Decorate the tree with lamps (all lamps at once).

Parameters

{tree} - id of the christmas tree

Request variables

color - lamp color

Request body

{
    "color": "green"
}

Response body

{
    "success": true
}

curl

curl -X PUT -d '{"color":"green"}' https://vanocnistrom.org/api/QTREIOJV/lamps

test url

https://vanocnistrom.org/api/QTREIOJV/lamps?method=PUT&color=green

PUT /{tree}/lamps/{part}

Decorate the tree with one single lamp pair.

Parameters

{tree} - id of the christmas tree
{part} - part number of the lamp pair

Request variables

color - lamp color

Request body

{
    "color": "green"
}

Response body

{
    "success": true
}

curl

curl -X PUT -d '{"color":"green"}' https://vanocnistrom.org/api/QTREIOJV/lamps/1

test url

https://vanocnistrom.org/api/QTREIOJV/lamps/1?method=PUT&color=green

DELETE /{tree}/lamps

Remove all lamps from the tree.

Parameters

{tree} - id of the christmas tree

Response body

{
    "success": true
}

curl

curl -X DELETE https://vanocnistrom.org/api/QTREIOJV/lamps

test url

https://vanocnistrom.org/api/QTREIOJV/lamps?method=DELETE

DELETE /{tree}/lamps/{part}

Remove one lamp pair from the tree.

Parameters

{tree} - id of the christmas tree
{part} - part number of the lamp pair

Response body

{
    "success": true
}

curl

curl -X DELETE https://vanocnistrom.org/api/QTREIOJV/lamps/1

test url

https://vanocnistrom.org/api/QTREIOJV/lamps/1?method=DELETE

Gifts

GET /{tree}/gifts

Return information about all gifts under the tree. (Be careful, the id of gitfts is changing continuously!)

Parameters

{tree} - id of the christmas tree

Response body

[
    {
        "id": 0,
        "color": "red",
        "labelColor": "red",
        "ribbonColor": "lightred",
        "label": "George"
    },
    {
        "id": 1,
        "color": "blue",
        "labelColor": "blue",
        "ribbonColor": "lightblue",
        "label": "Maggie"
    },
    {
        "id": 2,
        "color": "brown",
        "labelColor": "green",
        "ribbonColor": "lightgreen",
        "label": "Kristina"
    },
    {
        "id": 3,
        "color": "green",
        "labelColor": "white",
        "ribbonColor": "white",
        "label": "Carl V."
    },
    {
        "id": 4,
        "color": "white",
        "labelColor": "red",
        "ribbonColor": "lightred",
        "label": "Anett"
    }
]

curl

curl https://vanocnistrom.org/api/QTREIOJV/gifts

test url

https://vanocnistrom.org/api/QTREIOJV/gifts

GET /{tree}/gifts/{part}

Return information about one single gift. (Be careful, the id of gitfts is changing continuously!)

Parameters

{tree} - id of the christmas tree
{part} - part number of the gift

Response body

{
    "id": 0,
    "color": "red",
    "labelColor": "red",
    "ribbonColor": "lightred",
    "label": "George"
}

curl

curl https://vanocnistrom.org/api/QTREIOJV/gifts/0

test url

https://vanocnistrom.org/api/QTREIOJV/gifts/0

PUT /{tree}/gifts

Lay one gift under the tree. (Be careful, the id of gitfts is changing continuously!)

Parameters

{tree} - id of the christmas tree

Request variables

color - color of the gift
labelColor - color of the label on the gift
ribbonColor - color of the ribbon on the gift
label - label on the gift

Request body

{
    "color": "green",
    "labelColor": "blue",
    "ribbonColor": "lightgreen",
    "label": "Jan"
}

Response body

{
    "success": true
}

curl

curl -X PUT -d '{"color":"green","labelColor":"blue","ribbonColor":"lightgreen","label":"Jan"}' https://vanocnistrom.org/api/QTREIOJV/gifts

test url

https://vanocnistrom.org/api/QTREIOJV/gifts?method=PUT&color=green&labelColor=blue&ribbonColor=lightgreen&label=Jan

PUT /{tree}/gifts/{part}

Lay one gift under the tree at a given position. (Be careful, the id of gitfts is changing continuously!)

Parameters

{tree} - id of the christmas tree
{part} - part number of the gift

Request variables

color - color of the gift
labelColor - color of the label on the gift
ribbonColor - color of the ribbon on the gift
label - label on the gift

Request body

{
    "color": "green",
    "labelColor": "blue",
    "ribbonColor": "lightgreen",
    "label": "Jan"
}

Response body

{
    "success": true
}

curl

curl -X PUT -d '{"color":"green","labelColor":"blue","ribbonColor":"lightgreen","label":"Jan"}' https://vanocnistrom.org/api/QTREIOJV/gifts/1

test url

https://vanocnistrom.org/api/QTREIOJV/gifts/1?method=PUT&color=green&labelColor=blue&ribbonColor=lightgreen&label=Jan

DELETE /{tree}/gifts

Remove all gifts under the tree.

Parameters

{tree} - id of the christmas tree

Response body

{
    "success": true
}

curl

curl -X DELETE https://vanocnistrom.org/api/QTREIOJV/gifts

test url

https://vanocnistrom.org/api/QTREIOJV/gifts?method=DELETE

DELETE /{tree}/gifts/{part}

Remove one gift under the tree. (Be careful, the id of gitfts is changing continuously!)

Parameters

{tree} - id of the christmas tree
{part} - part number of the gift

Response body

{
    "success": true
}

curl

curl -X DELETE https://vanocnistrom.org/api/QTREIOJV/gifts/1

test url

https://vanocnistrom.org/api/QTREIOJV/gifts/1?method=DELETE

Whole scene

DELETE /{tree}

Wipe the whole scene.

Parameters

{tree} - id of the christmas tree

Response body

{
    "success": true
}

curl

curl -X DELETE https://vanocnistrom.org/api/QTREIOJV

test url

https://vanocnistrom.org/api/QTREIOJV?method=DELETE