# Редагування замовлення

## Редактирование заказа (общие параметры)

<mark style="color:green;">`POST`</mark> `/api/air/ordermodify`

Все запросы по редактированию заказа отправляются на указанный выше URL с передачей следующих обязательных параметров.\
\
Тело запроса передается в формате JSON.

#### Query Parameters

| Name  | Type   | Description      |
| ----- | ------ | ---------------- |
| key   | string | Static API key   |
| token | string | Static API token |

#### Headers

| Name         | Type   | Description                          |
| ------------ | ------ | ------------------------------------ |
| Accept       | string | application/json или application/xml |
| Content-Type | string | application/json                     |

#### Request Body

| Name      | Type   | Description                 |
| --------- | ------ | --------------------------- |
| UserLogin | string | Логин пользователя Бэкофиса |
| OrderHid  | string | Код заказа                  |
| Action    | string | Действие по заказу          |
| Params    | array  | Список параметров           |

{% tabs %}
{% tab title="200 Запрос успешно обработан." %}

```javascript
{
	"AviaOrderModifyResponse": {
		"StatusCode": 0, // Код ответа (0 - успешное выполнение операции)
		"Errors": [] // Список ошибок
		"Messages": [] // Список информационных сообщений
	}
}
```

{% endtab %}
{% endtabs %}

{% code title="Пример запроса" %}

```javascript
{
	"UserLogin": "sasha",
	"OrderHid": "fc320430-43eb-446f-8eab-cbd8544eecd3",
	"Action": "GoAction",
	"Params":
	{
	}
}
```

{% endcode %}

## Отмена заказа

<mark style="color:green;">`POST`</mark>&#x20;

#### Request Body

| Name   | Type   | Description                                                                       |
| ------ | ------ | --------------------------------------------------------------------------------- |
| Action | string | CancelOrder                                                                       |
| Params | array  | <p><code>{</code><br>  <code>"ConfirmAction": "True"</code><br><code>}</code></p> |

{% tabs %}
{% tab title="200 " %}

```javascript
{
	"AviaOrderModifyResponse": {
		"StatusCode": 0,
		"Messages": [
			"Order 17000 successfully canceled by sasha."
		]
	}
}
```

{% endtab %}
{% endtabs %}

{% code title="Пример запроса" %}

```javascript
{
	"UserLogin": "sasha",
	"OrderHid": "fc320430-43eb-446f-8eab-cbd8544eecd3",
	"Action": "CancelOrder",
	"Params":
	{
		"ConfirmAction": "True"
	}
}
```

{% endcode %}

## Установка для заказа статуса "Оплачен"

<mark style="color:green;">`POST`</mark>&#x20;

#### Request Body

| Name   | Type   | Description                                                                       |
| ------ | ------ | --------------------------------------------------------------------------------- |
| Action | string | SetPaidStatus                                                                     |
| Params | array  | <p><code>{</code><br>  <code>"ConfirmAction": "True"</code><br><code>}</code></p> |

{% tabs %}
{% tab title="200 " %}

```javascript
{
	"AviaOrderModifyResponse": {
		"StatusCode": 0,
		"Messages": [
			"Order 17000 status successfully set to 'Paid' by sasha."
		]
	}
}
```

{% endtab %}
{% endtabs %}

{% code title="Пример запроса" %}

```javascript
{
	"UserLogin": "sasha",
	"OrderHid": "fc320430-43eb-446f-8eab-cbd8544eecd3",
	"Action": "SetPaidStatus",
	"Params":
	{
		"ConfirmAction": "True"
	}
}
```

{% endcode %}

## Изменение признака синхронизации всей брони либо расчета в ней

<mark style="color:green;">`POST`</mark>&#x20;

#### Request Body

| Name         | Type   | Description                                                                                                                                         |
| ------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Action       | string | ChangeBookingNotSync                                                                                                                                |
| Params       | array  |                                                                                                                                                     |
| - BookingIds | string | "1, 2 ...", // Id бронирований для которых выполняется действий, если этот параметр не указан, действие применяется ко всем бронированниям в заказе |
| - NotSync    | string | "True" // Запретить синхронизацию бронирования                                                                                                      |
| - NotSyncFF  | string | "True" // Запретить синхронизацию поля расчета в бронировании                                                                                       |

{% tabs %}
{% tab title="200 " %}

```javascript
{
	"AviaOrderModifyResponse": {
		"StatusCode": 0,
		"Messages": [
			"Order 17000 'NotSync' status successfully updated by sasha."
		]
	}
}
```

{% endtab %}
{% endtabs %}

{% code title="Пример запроса" %}

```javascript
{
	"UserLogin": "sasha",
	"OrderHid": "fc320430-43eb-446f-8eab-cbd8544eecd3",
	"Action": "ChangeBookingNotSync",
	"Params":
	{
		"BookingIds": "3380",
		"NotSync": "True"
	}
}
```

{% endcode %}

## Добавление, удаление, изменение комментариев к бронированию

<mark style="color:green;">`POST`</mark>&#x20;

Список существующих комментариев к бронированию можно получить с помощью запроса /api/air/orderinfo (раздел Информация о заказе)

#### Request Body

| Name      | Type    | Description                                                                                     |
| --------- | ------- | ----------------------------------------------------------------------------------------------- |
| Action    | string  | BookingComments                                                                                 |
| Params    | array   |                                                                                                 |
| BookingId | integer | Идентификатор бронирования                                                                      |
| CommentId | integer | Идентификатор комментария                                                                       |
| - Action  | string  | <p>Действие с комментарием:<br>ADD - добавить;<br>EDIT - редактировать;<br>DELETE - удалить</p> |
| - Text    | string  | Текст комментария                                                                               |

{% tabs %}
{% tab title="200 Пример ответа при добавлении комментария" %}

```javascript
{
	"AviaOrderModifyResponse": {
		"StatusCode": 0,
		"Messages": [
			"Booking comment for user sashapvt successfully added."
		]
	}
}
```

{% endtab %}
{% endtabs %}

{% code title="Пример запроса (добавление комментария)" %}

```javascript
{
	"UserLogin": "sasha",
	"OrderHid": "fc320430-43eb-446f-8eab-cbd8544eecd3",
	"Action": "BookingComments",
	"Params":
	{
		"Action": "ADD",
		"BookingId": 3380,
		"Text": "Test comment new"
	}
}
```

{% endcode %}

{% code title="Пример запроса (редактирование комментария)" %}

```javascript
{
	"UserLogin": "sasha",
	"OrderHid": "fc320430-43eb-446f-8eab-cbd8544eecd3",
	"Action": "BookingComments",
	"Params":
	{
		"Action": "EDIT",
		"BookingId": 3380,
		"CommentId": 25866,
		"Text": "Test comment new edited"
	}
}
```

{% endcode %}

{% code title="Пример запроса (удаление комментария)" %}

```javascript
{
	"UserLogin": "sasha",
	"OrderHid": "fc320430-43eb-446f-8eab-cbd8544eecd3",
	"Action": "BookingComments",
	"Params":
	{
		"Action": "DELETE",
		"BookingId": 3380,
		"CommentId": 25866
	}
}
```

{% endcode %}


---

# 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://help.rezonuniversal.com/metody-api/avia/redaktirovanie-zakaza.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.
