Штрихкоди

Список штрихкодів

Отримати список штрихкодів

GET /api/barCodes{?bar_code,id_goods,filters,active,order,offset,limit}

Параметри

Параметр

Тип

Обов’язковий

Опис

bar_code

integer

ні

Штрихкод товару. Якщо вказати, буде повернено список для цього штрихкоду

id_goods

integer

ні

Код товару. Якщо вказати, буде повернено список для цього товару

filters

string

ні

Текстові фільтри у форматі: field_name:: |field_name1::

active

string

ні

Якщо параметр дорівнює “true”, то повертаються лише активні записи.

order

string

ні

Список полів сортування через кому без пробілів. Для зворотного сортування поставити - перед іменем поля.

offset

integer

ні

Повертати дані, починаючи з указаного номера запису

limit

integer

ні

Повертати вказану кількість записів

Відповідь 200 (application/json)

[
  {
    "bar_code": "4052557303215",
    "id_unit": 1,
    "id_goods": 910,
    "id_series": "-",
    "ext_bar_code": "-",
    "active": true
  }
]

Додати штрихкод

POST /api/barCodes{?bar_code,id_goods,filters,active,order,offset,limit}

Ключові атрибути bar_code, id_goods, id_unit, ext_bar_code, id_series в JSON-і запиту стандартно ігноруються. Щоб додати штрихкод, використовуйте параметр unprotect_keys=true і вказуйте значення ключових полів у тілі запиту.

Заголовки запиту:

  • Content-Type: application/json

Тіло запиту:

{
  "bar_code": "4052557303215",
  "id_unit": 1,
  "id_goods": 910,
  "id_series": "-",
  "ext_bar_code": "-",
  "active": true
}

Відповідь 201 (application/json)

{
  "bar_code": "4052557303215",
  "id_unit": 1,
  "id_goods": 910,
  "id_series": "-",
  "ext_bar_code": "-",
  "active": true
}

Схема:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "bar_code": {
      "type": "string"
    },
    "id_unit": {
      "type": "number"
    },
    "id_goods": {
      "type": "number"
    },
    "id_series": {
      "type": "string"
    },
    "ext_bar_code": {
      "type": "string"
    },
    "active": {
      "type": "boolean"
    }
  },
  "required": [
    "bar_code",
    "id_unit",
    "id_goods",
    "id_series",
    "ext_bar_code",
    "active"
  ]
}

Кількість штрихкодів

Отримати кількість штрихкодів

GET /api/barCodes/count{?id_goods,bar_code,filters,active}

Повертає кількість записів

Параметри

Параметр

Тип

Обов’язковий

Опис

id_goods

integer

ні

Код товару

bar_code

string

ні

Штрихкод

filters

string

ні

Текстові фільтри у форматі: field_name:: |field_name1::

active

string

ні

Якщо параметр дорівнює “true”, то повертаються лише активні товари.

Відповідь 200 (application/json)

{
  "count": 10
}

Схема:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "count": {
      "type": "number"
    }
  },
  "required": [
    "count"
  ]
}

Штрихкод

Отримати дані про штрихкод

GET /api/barCodes/{bar_code}/{id_goods}/{id_unit}/{?ext_bar_code}/{?id_series}

  • Параметри ext_bar_code, id_series можна опускати, якщо для обох використовуються значення за замовчуванням.

  • Для зазначення значення за замовчуванням для параметра ext_bar_code або id_series використовувати слово default

Параметри

Параметр

Тип

Обов’язковий

Опис

bar_code

integer

так

Штрихкод товару

id_goods

integer

так

Код товару

id_unit

integer

так

Код одиниці виміру

ext_bar_code

string

так

Розширений штрихкод

id_series

string

так

Код серії

Відповідь 200 (application/json)

{
  "bar_code": "4052557303215",
  "id_unit": 1,
  "id_goods": 910,
  "id_series": "-",
  "ext_bar_code": "-",
  "active": true
}

Схема:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "bar_code": {
      "type": "string"
    },
    "id_unit": {
      "type": "number"
    },
    "id_goods": {
      "type": "number"
    },
    "id_series": {
      "type": "string"
    },
    "ext_bar_code": {
      "type": "string"
    },
    "active": {
      "type": "boolean"
    }
  },
  "required": [
    "bar_code",
    "id_unit",
    "id_goods",
    "id_series",
    "ext_bar_code",
    "active"
  ]
}

Змінити дані про штрихкод

PUT /api/barCodes/{bar_code}/{id_goods}/{id_unit}/{?ext_bar_code}/{?id_series}

Ключові атрибути bar_code, id_goods, id_unit, ext_bar_code, id_series у JSON-і запиту стандартно ігноруються.

  • Для зміни ключових полів використовувати параметр unprotect_keys=true

Параметри

Параметр

Тип

Обов’язковий

Опис

bar_code

integer

так

Штрихкод товару

id_goods

integer

так

Код товару

id_unit

integer

так

Код одиниці виміру

ext_bar_code

string

так

Розширений штрихкод

id_series

string

так

Код серії

Заголовки запиту:

  • Content-Type: application/json

Тіло запиту:

{
  "bar_code": "4052557303215",
  "id_unit": 1,
  "id_goods": 910,
  "id_series": "-",
  "ext_bar_code": "-",
  "active": true
}

Відповідь 200 (application/json)

{
  "bar_code": "4052557303215",
  "id_unit": 1,
  "id_goods": 910,
  "id_series": "-",
  "ext_bar_code": "-",
  "active": true
}

Схема:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "bar_code": {
      "type": "string"
    },
    "id_unit": {
      "type": "number"
    },
    "id_goods": {
      "type": "number"
    },
    "id_series": {
      "type": "string"
    },
    "ext_bar_code": {
      "type": "string"
    },
    "active": {
      "type": "boolean"
    }
  },
  "required": [
    "bar_code",
    "id_unit",
    "id_goods",
    "id_series",
    "ext_bar_code",
    "active"
  ]
}

Деактивувати дані про штрихкод

DELETE /api/barCodes/{bar_code}/{id_goods}/{id_unit}/{?ext_bar_code}/{?id_series}

Відповідь 204