# Article categories

Each product or service within the PORTOS system is linked to a specific category (e.g. desserts, soups, meals, ...), which is referred to as the **article category**. This categorization helps in organizing and classifying items, allowing for efficient management and navigation within the system.

Article category is represented by [`ArticleCategory`](/data-models.md#articlecategory) class.

## API methods

## Get article categories

<mark style="color:blue;">`GET`</mark> `http://{server-address}/articlecategories`

Returns all article categories that matches query parameters. Result is of type [`QueryResult<ArticleCategory>`](/data-models.md#queryresult).

#### Query Parameters

| Name         | Type      | Description                                                                                                              |
| ------------ | --------- | ------------------------------------------------------------------------------------------------------------------------ |
| color        | string    | Supports NData syntax.                                                                                                   |
| courseNumber | int       | Supports NData syntax.                                                                                                   |
| $skip        | int       | Pagination property. Describing number of records to skip from beginning of result collection.                           |
| $take        | int       | Pagination property. Maximum count of items to be returned.                                                              |
| $sort        | string\[] | <p>Comma separated list of property names. Please see NData syntax.<br></p>                                              |
| $count       | bool      | If set to `true`, response will not contain `items` collection. Use to get resource count, not the resources themselves. |
| label        | string    | Supports NData syn                                                                                                       |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

{% tabs %}
{% tab title="200: OK Successful response" %}

```javascript
{
    "items":
    [
        {
            "_v": 1,
            "description": "Daily menu",
            "label": "MNU",
            "color": "#AED581",
            "courseNumber": null,
            "customerDescription": "Meals according to the daily menu",
            "sortHint": 1,
            "tags":
            [
                "Kitchen"
            ],
            "ordering":
            [
                {
                    "orderOrigin": "Online",
                    "enabled": true,
                    "weeklySchedule":
                    [
                        {
                            "days":
                            [
                                "Monday",
                                "Tuesday",
                                "Wednesday",
                                "Thursday",
                                "Friday"
                            ],
                            "timeRange":
                            {
                                "from": "11:00:00",
                                "to": "13:30:00"
                            }
                        }
                    ]
                }
            ]
        },
        {
            "label": "BRS",
            "description": "Beers",
            "customerDescription": null,
            "courseNumber": null,
            "color": "#FF8F00",
            "sortHint": 1,
            "tags":
            [],
            "_v": 1
        },
        {
            "label": "SOF",
            "description": "Soft Drinks",
            "customerDescription": null,
            "courseNumber": null,
            "color": null,
            "sortHint": null,
            "tags":
            [],
            "_v": 1
        }
    ],
    "count": 3,
    "totalCount": 3
}
```

{% endtab %}
{% endtabs %}

## Get article category by label

<mark style="color:blue;">`GET`</mark> `http://{server-address}/articlecategories/{label}`

Result is of type [Article category](/data-models.md#articlecategory).

#### Path Parameters

| Name                                    | Type   | Description                    |
| --------------------------------------- | ------ | ------------------------------ |
| label<mark style="color:red;">\*</mark> | string | Unique article category label. |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

{% tabs %}
{% tab title="200: OK Resource found." %}

```javascript
{
    "_v": 1,
    "description": "Daily menu",
    "label": "MNU",
    "color": "#AED581",
    "courseNumber": null,
    "customerDescription": "Meals according to the daily menu",
    "sortHint": 1,
    "tags":
    [
        "Kitchen"
    ],
    "ordering":
    [
        {
            "orderOrigin": "Online",
            "enabled": true,
            "weeklySchedule":
            [
                {
                    "days":
                    [
                        "Monday",
                        "Tuesday",
                        "Wednesday",
                        "Thursday",
                        "Friday"
                    ],
                    "timeRange":
                    {
                        "from": "11:00:00",
                        "to": "13:30:00"
                    }
                }
            ]
        }
    ]
}
```

{% endtab %}

{% tab title="404: Not Found Article category with given label is not found." %}

```javascript
{
    "title": "Zdroj nebol nájdený",
    "status": 404
}
```

{% endtab %}
{% endtabs %}

## Create article category

<mark style="color:green;">`POST`</mark> `http://{server-address}/articlecategories`

Creates new article category. Result is of type [Article category](/data-models.md#articlecategory).

**Required rights**

Authorized user must have `ArticleCategoryCreate` [right ](/user-rights.md)assigned.

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

#### Request Body

| Name                                     | Type            | Description      |
| ---------------------------------------- | --------------- | ---------------- |
| (body)<mark style="color:red;">\*</mark> | ArticleCategory | Model to create. |

{% tabs %}
{% tab title="201: Created Successfuly created." %}

```javascript
{
    "_v": 1,
    "description": "Daily menu",
    "label": "MNU",
    "color": "#AED581",
    "courseNumber": null,
    "customerDescription": "Meals according to the daily menu",
    "sortHint": 1,
    "tags":
    [
        "Kitchen"
    ],
    "ordering":
    [
        {
            "orderOrigin": "Online",
            "enabled": true,
            "weeklySchedule":
            [
                {
                    "days":
                    [
                        "Monday",
                        "Tuesday",
                        "Wednesday",
                        "Thursday",
                        "Friday"
                    ],
                    "timeRange":
                    {
                        "from": "11:00:00",
                        "to": "13:30:00"
                    }
                }
            ]
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Create or update article category

<mark style="color:orange;">`PUT`</mark> `http://{server-address}/articlecategories/{label}`

Creates new or updates existing article category. Result is of type [Article category](/data-models.md#articlecategory).

**Required rights**

Authorized user must have assigned `ArticleCategoryCreate` or `ArticleCategoryUpdate` [right](/user-rights.md).

#### Path Parameters

| Name                                    | Type   | Description                    |
| --------------------------------------- | ------ | ------------------------------ |
| label<mark style="color:red;">\*</mark> | string | Unique article category label. |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

#### Request Body

| Name                                     | Type            | Description                |
| ---------------------------------------- | --------------- | -------------------------- |
| (body)<mark style="color:red;">\*</mark> | ArticleCategory | Model to create or update. |

{% tabs %}
{% tab title="200: OK Successfuly created or updated." %}

```javascript
{
    "_v": 1,
    "description": "Daily menu",
    "label": "MNU",
    "color": "#AED581",
    "courseNumber": null,
    "customerDescription": "Meals according to the daily menu",
    "sortHint": 1,
    "tags":
    [
        "Kitchen"
    ],
    "ordering":
    [
        {
            "orderOrigin": "Online",
            "enabled": true,
            "weeklySchedule":
            [
                {
                    "days":
                    [
                        "Monday",
                        "Tuesday",
                        "Wednesday",
                        "Thursday",
                        "Friday"
                    ],
                    "timeRange":
                    {
                        "from": "11:00:00",
                        "to": "13:30:00"
                    }
                }
            ]
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Delete article category by label

<mark style="color:red;">`DELETE`</mark> `http://{server-address}/articlecategories/{label}`

**Required rights**

Authorized user must have `ArticleCategoryDelete` [right ](/user-rights.md)assigned.

#### Path Parameters

| Name                                    | Type   | Description                    |
| --------------------------------------- | ------ | ------------------------------ |
| label<mark style="color:red;">\*</mark> | string | Unique article category label. |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

{% tabs %}
{% tab title="200: OK Successfuly deleted." %}

```javascript
{
    "_v": 1,
    "description": "Daily menu",
    "label": "MNU",
    "color": "#AED581",
    "courseNumber": null,
    "customerDescription": "Meals according to the daily menu",
    "sortHint": 1,
    "tags":
    [
        "Kitchen"
    ],
    "ordering":
    [
        {
            "orderOrigin": "Online",
            "enabled": true,
            "weeklySchedule":
            [
                {
                    "days":
                    [
                        "Monday",
                        "Tuesday",
                        "Wednesday",
                        "Thursday",
                        "Friday"
                    ],
                    "timeRange":
                    {
                        "from": "11:00:00",
                        "to": "13:30:00"
                    }
                }
            ]
        }
    ]
}
```

{% endtab %}

{% tab title="404: Not Found Given resource was not found." %}

```javascript
{
    "title": "Zdroj nebol nájdený",
    "status": 404
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.portos.sk/api-reference/article-categories.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
