Portion
A portion is a size a product can be sold in - a percentage of the standard portion, sold for a percentage
of the standard price. A half portion for 60% of the price is portion: 50, price: 60.
Portions are stored as tags named .portion-<portion>-<price> (both numbers with five decimals,
e.g. .portion-50.00000-60.00000), and a product offers a portion by carrying that name in its tags.
These endpoints are the supported way to manage them: the tag endpoints hide the names behind their leading
dot, and a repeated POST /tags answers with the tag that is already there instead of refusing.
A portion is assigned to a product through the product's tags, not here.
A portion cannot be edited. Its numbers are the tag's name, and products, categories, customers and reservations all reference a tag by name rather than by ID, so changing them would mean rewriting every record that carries the old one. Create the portion you want and delete the one you no longer need - and note that deleting is refused while anything still carries it.
Portion schema
id integer?
Portion ID (the ID of the tag holding it)
portion decimal
Size of the portion, as a percentage of the standard portion. Must be positive, at most 5 decimals.
price decimal
Price of the portion, as a percentage of the standard price. Must be positive, at most 5 decimals.
display boolean?
Whether the portion is offered in the POS menu. Defaults to true when creating.
deleted boolean
Cannot be true in the POST method
versionDate timestamp?
Last modification date and time
JSON response
{
"id": <integer>,
"portion": <decimal>,
"price": <decimal>,
"display": <boolean>,
"deleted": <boolean>,
"versionDate": <timestamp>
}
Get portions
GET https://api.dotykacka.cz/v2/clouds/:cloudId/portions
Path Parameters
| Name | Type | Description |
|---|---|---|
| cloudId* | integer |
Header Parameters
| Name | Type | Description |
|---|---|---|
| Authorization* | string | Bearer accessToken |
Query Parameters
| Name | Type | Description |
|---|---|---|
| sort | string | |
| page | integer | |
| filter | string | |
| limit | integer |
Responses
[
{
Entity response schema
},
...
]
Get portion
GET https://api.dotykacka.cz/v2/clouds/:cloudId/portions/:portionId
Path Parameters
| Name | Type | Description |
|---|---|---|
| cloudId* | integer | |
| portionId* | integer |
Responses
Create portion
POST https://api.dotykacka.cz/v2/clouds/:cloudId/portions
Takes a single portion, not a list.
A portion with the same portion and price can exist only once - creating one that already exists is
answered with 400 naming the reason, so the client can tell the user which portion is already there:
{
"status": 400,
"error": "Bad Request",
"message": "Portion '.portion-50.00000-60.00000' already exists",
"reason": "PORTION_ALREADY_EXISTS"
}
Path Parameters
| Name | Type | Description |
|---|---|---|
| cloudId* | integer |
Request Body
{
"portion": 50,
"price": 60,
"display": true
}
Responses
Delete portion
DELETE https://api.dotykacka.cz/v2/clouds/:cloudId/portions/:portionId
A portion still offered by a product cannot be deleted - the 400 names the products, which have to stop
offering it first.
Path Parameters
| Name | Type | Description |
|---|---|---|
| cloudId* | integer | |
| portionId* | integer |
Responses