Discount
INFO
Каждый ответ приходит в общем конверте — code, message, messages, status_code, time — а полезная нагрузка лежит в data. Таблицы ниже описывают содержимое data.
POST /discount/create
This method allows adding discount into the account.
Тело запроса
| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
name | string | Да | |
organization_ids | string[] | Да | |
auto_attach | boolean | Да | |
is_manual | boolean | Да | |
state | string | Да | Допустимые значения: not_started, active, expired |
live_type | string | Да | Допустимые значения: forever, duration |
assign_type | string | Да | Допустимые значения: all, specific |
apply_type | string | Да | Допустимые значения: percent, cash |
value | number | Да | |
currency_id | string | Да | |
starting_date | string | Да | |
ending_date | string | Да | |
is_all_categories | boolean | Да | |
category_ids | string[] | Нет | |
nested_category_ids | string[] | Да | |
item_added_ids | string[] | Да | Product ids |
{
"name": "string",
"organization_ids": [
"string"
],
"auto_attach": false,
"is_manual": false,
"state": "not_started",
"live_type": "forever",
"assign_type": "all",
"apply_type": "percent",
"value": 0,
"currency_id": "string",
"starting_date": "string",
"ending_date": "string",
"is_all_categories": false,
"category_ids": [
"string"
],
"nested_category_ids": [
"string"
],
"item_added_ids": [
"string"
]
}Ответ
| Поле | Тип | Описание |
|---|---|---|
_id | string | id of discount |
name | string | |
organization_ids | string[] | |
auto_attach | boolean | |
is_manual | boolean | |
state | string | Допустимые значения: not_started, active, expired |
live_type | string | Допустимые значения: forever, duration |
assign_type | string | Допустимые значения: all, specific |
apply_type | string | Допустимые значения: percent, cash |
value | number | |
currency_id | string | |
starting_date | string | |
ending_date | string | |
is_all_categories | boolean | |
category_ids | string[] | |
nested_category_ids | string[] | |
item_added_ids | string[] |
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": {
"_id": "string",
"name": "string",
"organization_ids": [
"string"
],
"auto_attach": false,
"is_manual": false,
"state": "not_started",
"live_type": "forever",
"assign_type": "all",
"apply_type": "percent",
"value": 0,
"currency_id": "string",
"starting_date": "string",
"ending_date": "string",
"is_all_categories": false,
"category_ids": [
"string"
],
"nested_category_ids": [
"string"
],
"item_added_ids": [
"string"
]
},
"time": "2025-05-01T12:00:00Z"
}PUT /discount/update
This method allows updating discount in the account.
Тело запроса
| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
name | string | Да | |
organization_ids | string[] | Да | |
auto_attach | boolean | Да | |
is_manual | boolean | Да | |
state | string | Да | Допустимые значения: not_started, active, expired |
live_type | string | Да | Допустимые значения: forever, duration |
assign_type | string | Да | Допустимые значения: all, specific |
apply_type | string | Да | Допустимые значения: percent, cash |
value | number | Да | |
currency_id | string | Да | |
starting_date | string | Да | |
ending_date | string | Да | |
is_all_categories | boolean | Да | |
category_ids | string[] | Нет | |
nested_category_ids | string[] | Да | |
item_added_ids | string[] | Да | Product ids |
_id | string | Да | id of customer |
{
"name": "string",
"organization_ids": [
"string"
],
"auto_attach": false,
"is_manual": false,
"state": "not_started",
"live_type": "forever",
"assign_type": "all",
"apply_type": "percent",
"value": 0,
"currency_id": "string",
"starting_date": "string",
"ending_date": "string",
"is_all_categories": false,
"category_ids": [
"string"
],
"nested_category_ids": [
"string"
],
"item_added_ids": [
"string"
],
"_id": "string"
}Ответ
Структура ответа совпадает с POST /discount/create.
DELETE /discount/delete/{id}
Delete a discount
Параметры пути
| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
id | string | Да |
Тело запроса
Тело запроса не требуется.
Ответ
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": "ok",
"time": "2025-05-01T12:00:00Z"
}GET /discount/get-by-id/{id}
Get discount using its _id
Параметры пути
| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
id | string | Да |
Тело запроса
Тело запроса не требуется.
Ответ
Структура ответа совпадает с POST /discount/create.
POST /discount/get-paging
Get discounts by paging
Тело запроса
| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
page | number | Да | По умолчанию: 1 |
limit | number | Да | По умолчанию: 20 |
apply_type | string | Нет | |
states | string | Нет | |
search | string | Нет | |
currency_id | string | Нет | |
is_expired | boolean | Нет | |
organization_ids | string[] | Нет |
{
"page": 1,
"limit": 20,
"apply_type": "string",
"states": "string",
"search": "string",
"currency_id": "string",
"is_expired": false,
"organization_ids": [
"string"
]
}Ответ
data.total — общее количество записей, data.data[] — записи текущей страницы. Таблица ниже описывает одну запись.
| Поле | Тип | Описание |
|---|---|---|
_id | string | id of discount |
name | string | |
organization_ids | string[] | |
auto_attach | boolean | |
is_manual | boolean | |
state | string | Допустимые значения: not_started, active, expired |
live_type | string | Допустимые значения: forever, duration |
assign_type | string | Допустимые значения: all, specific |
apply_type | string | Допустимые значения: percent, cash |
value | number | |
currency_id | string | |
starting_date | string | |
ending_date | string | |
is_all_categories | boolean | |
category_ids | string[] | |
nested_category_ids | string[] | |
item_added_ids | string[] |
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": {
"total": 0,
"data": [
{
"_id": "string",
"name": "string",
"organization_ids": [
"string"
],
"auto_attach": false,
"is_manual": false,
"state": "not_started",
"live_type": "forever",
"assign_type": "all",
"apply_type": "percent",
"value": 0,
"currency_id": "string",
"starting_date": "string",
"ending_date": "string",
"is_all_categories": false,
"category_ids": [
"string"
],
"nested_category_ids": [
"string"
],
"item_added_ids": [
"string"
]
}
]
},
"time": "2025-05-01T12:00:00Z"
}POST /discount/get-all
Get all discounts
Тело запроса
| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
apply_type | string | Нет | Допустимые значения: percent, cash |
currency_id | string | Нет | |
organization_ids | string[] | Нет | |
is_expired | boolean | Нет | |
states | string[] | Нет |
{
"apply_type": "percent",
"currency_id": "64e5b499189503e999999999",
"organization_ids": [
"64e5b499189503e999999999"
],
"is_expired": false,
"states": [
"active"
]
}Ответ
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": [
{
"_id": "string",
"name": "string",
"organization_ids": [
"string"
],
"auto_attach": false,
"is_manual": false,
"state": "not_started",
"live_type": "forever",
"assign_type": "all",
"apply_type": "percent",
"value": 0,
"currency_id": "string",
"starting_date": "string",
"ending_date": "string",
"is_all_categories": false,
"category_ids": [
"string"
],
"nested_category_ids": [
"string"
],
"item_added_ids": [
"string"
]
}
],
"time": "2025-05-01T12:00:00Z"
}GET /discount/get-deleted
Get deleted discount ids
Параметры запроса
| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
deleted_at | string | Да |
Тело запроса
Тело запроса не требуется.
Ответ
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": [
"string"
],
"time": "2025-05-01T12:00:00Z"
}Эта страница сгенерирована из спецификации OpenAPI.