# Order endpoints

Once the product (PLU) is added to the [`Ticket`](/data-models.md#ticket), an [`Order`](/data-models.md#order) is created. Based on product settings, order is sent to one or multiple [order endpoints](/data-models.md#orderendpoint) for processing. The order endpoint serves as a device that handles incoming orders. This endpoint can take the form of either a printer, such as a kitchen printer, which generates printed instructions for the food preparation team, or a tablet that enables personnel to provide feedback to cashiers once the food is being prepared or is ready for pickup.

Order endpoint device is represented by [`OrderEndpoint`](/data-models.md#orderendpoint) class.

## API methods

## Get order endpoints

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

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

#### Query Parameters

| Name     | Type      | Description                                                                                                              |
| -------- | --------- | ------------------------------------------------------------------------------------------------------------------------ |
| name     | string    | 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. |
| isActive | bool      | Supports NData syntax.                                                                                                   |
| type     | string    | Supports NData syntax.                                                                                                   |
| address  | string    | Supports NData syntax.                                                                                                   |

#### 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":
    [
        {
            "name": "Kitchen",
            "isActive": false,
            "address": "\\\\computer_name\\Kitchen",
            "type": "SRP350",
            "settings":
            {
                "IsBeepEnabled": "true",
                "HighlightOrderNumber": "true",
                "DoubleHeightFont": "true",
                "DoubleWidthFont": "true"
            },
            "_v": 1
        },
        {
            "name": "Pizza",
            "isActive": false,
            "address": "\\\\computer_name\\Pizza",
            "type": "TM88",
            "settings":
            {},
            "_v": 1
        }
    ],
    "count": 2,
    "totalCount": 2
}
```

{% endtab %}
{% endtabs %}

## Get order endpoint by name

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

Result is of type [`OrderEndpoint`](/data-models.md#orderendpoint).

#### Path Parameters

| Name                                   | Type   | Description                 |
| -------------------------------------- | ------ | --------------------------- |
| name<mark style="color:red;">\*</mark> | string | Unique order endpoint name. |

#### Headers

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

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

```javascript
{
    "name": "Kitchen",
    "isActive": false,
    "address": "\\\\computer_name\\Kitchen",
    "type": "SRP350",
    "settings":
    {
        "IsBeepEnabled": "true",
        "HighlightOrderNumber": "true",
        "DoubleHeightFont": "true",
        "DoubleWidthFont": "true"
    },
    "_v": 1
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## Create order endpoint

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

Creates new order endpoint. Result is of type [`OrderEndpoint`](/data-models.md#orderendpoint).

**Required rights**

Authorized user must have `OrderEndpointCreate` [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> | OrderEndpoint | Model to create. |

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

```javascript
{
    "name": "Kitchen",
    "isActive": false,
    "address": "\\\\computer_name\\Kitchen",
    "type": "SRP350",
    "settings":
    {
        "IsBeepEnabled": "true",
        "HighlightOrderNumber": "true",
        "DoubleHeightFont": "true",
        "DoubleWidthFont": "true"
    },
    "_v": 1
}
```

{% endtab %}
{% endtabs %}

## Create or update order endpoint

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

Creates new or updates existing order endpoint. Result is of type [`OrderEndpoint`](/data-models.md#orderendpoint).

**Required rights**

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

#### Path Parameters

| Name                                   | Type   | Description                 |
| -------------------------------------- | ------ | --------------------------- |
| name<mark style="color:red;">\*</mark> | string | Unique order endpoint name. |

#### 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> | OrderEndpoint | Model to create or update. |

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

```javascript
{
    "name": "Kitchen",
    "isActive": false,
    "address": "\\\\computer_name\\Kitchen",
    "type": "SRP350",
    "settings":
    {
        "IsBeepEnabled": "true",
        "HighlightOrderNumber": "true",
        "DoubleHeightFont": "true",
        "DoubleWidthFont": "true"
    },
    "_v": 2
}
```

{% endtab %}
{% endtabs %}

## Delete order endpoint by name

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

**Required rights**

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

#### Path Parameters

| Name                                   | Type   | Description                 |
| -------------------------------------- | ------ | --------------------------- |
| name<mark style="color:red;">\*</mark> | string | Unique order endpoint name. |

#### Headers

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

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

```javascript
{
    "name": "Kitchen",
    "isActive": false,
    "address": "\\\\computer_name\\Kitchen",
    "type": "SRP350",
    "settings":
    {
        "IsBeepEnabled": "true",
        "HighlightOrderNumber": "true",
        "DoubleHeightFont": "true",
        "DoubleWidthFont": "true"
    },
    "_v": 1
}
```

{% 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/order-endpoints.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.
