Skip to content

Discount ​

INFO

Каждый ответ приходит в общем конверте — code, message, messages, status_code, time — а полезная нагрузка лежит в data. Таблицы ниже описывают содержимое data.

POST /discount/create ​

This method allows adding discount into the account.

Тело запроса

ПолеТипОбязательноОписание
namestringДа
organization_idsstring[]Да
auto_attachbooleanДа
is_manualbooleanДа
statestringДаДопустимые значения: not_started, active, expired
live_typestringДаДопустимые значения: forever, duration
assign_typestringДаДопустимые значения: all, specific
apply_typestringДаДопустимые значения: percent, cash
valuenumberДа
currency_idstringДа
starting_datestringДа
ending_datestringДа
is_all_categoriesbooleanДа
category_idsstring[]Нет
nested_category_idsstring[]Да
item_added_idsstring[]ДаProduct ids
json
{
  "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"
  ]
}

Ответ

ПолеТипОписание
_idstringid of discount
namestring
organization_idsstring[]
auto_attachboolean
is_manualboolean
statestringДопустимые значения: not_started, active, expired
live_typestringДопустимые значения: forever, duration
assign_typestringДопустимые значения: all, specific
apply_typestringДопустимые значения: percent, cash
valuenumber
currency_idstring
starting_datestring
ending_datestring
is_all_categoriesboolean
category_idsstring[]
nested_category_idsstring[]
item_added_idsstring[]
json
{
  "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.

Тело запроса

ПолеТипОбязательноОписание
namestringДа
organization_idsstring[]Да
auto_attachbooleanДа
is_manualbooleanДа
statestringДаДопустимые значения: not_started, active, expired
live_typestringДаДопустимые значения: forever, duration
assign_typestringДаДопустимые значения: all, specific
apply_typestringДаДопустимые значения: percent, cash
valuenumberДа
currency_idstringДа
starting_datestringДа
ending_datestringДа
is_all_categoriesbooleanДа
category_idsstring[]Нет
nested_category_idsstring[]Да
item_added_idsstring[]ДаProduct ids
_idstringДаid of customer
json
{
  "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

Параметры пути

ПараметрТипОбязательноОписание
idstringДа

Тело запроса

Тело запроса не требуется.

Ответ

json
{
  "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

Параметры пути

ПараметрТипОбязательноОписание
idstringДа

Тело запроса

Тело запроса не требуется.

Ответ

Структура ответа совпадает с POST /discount/create.

POST /discount/get-paging ​

Get discounts by paging

Тело запроса

ПолеТипОбязательноОписание
pagenumberДаПо умолчанию: 1
limitnumberДаПо умолчанию: 20
apply_typestringНет
statesstringНет
searchstringНет
currency_idstringНет
is_expiredbooleanНет
organization_idsstring[]Нет
json
{
  "page": 1,
  "limit": 20,
  "apply_type": "string",
  "states": "string",
  "search": "string",
  "currency_id": "string",
  "is_expired": false,
  "organization_ids": [
    "string"
  ]
}

Ответ

data.total — общее количество записей, data.data[] — записи текущей страницы. Таблица ниже описывает одну запись.

ПолеТипОписание
_idstringid of discount
namestring
organization_idsstring[]
auto_attachboolean
is_manualboolean
statestringДопустимые значения: not_started, active, expired
live_typestringДопустимые значения: forever, duration
assign_typestringДопустимые значения: all, specific
apply_typestringДопустимые значения: percent, cash
valuenumber
currency_idstring
starting_datestring
ending_datestring
is_all_categoriesboolean
category_idsstring[]
nested_category_idsstring[]
item_added_idsstring[]
json
{
  "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_typestringНетДопустимые значения: percent, cash
currency_idstringНет
organization_idsstring[]Нет
is_expiredbooleanНет
statesstring[]Нет
json
{
  "apply_type": "percent",
  "currency_id": "64e5b499189503e999999999",
  "organization_ids": [
    "64e5b499189503e999999999"
  ],
  "is_expired": false,
  "states": [
    "active"
  ]
}

Ответ

json
{
  "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_atstringДа

Тело запроса

Тело запроса не требуется.

Ответ

json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": [
    "string"
  ],
  "time": "2025-05-01T12:00:00Z"
}

Эта страница сгенерирована из спецификации OpenAPI.

Bito 2.0 Integration API