{
  "openapi": "3.0.1",
  "info": {
    "title": "Документация по SelSup API",
    "description": "API SelSup — программный интерфейс для работы с сервисом SelSup. Даёт возможность работать со всеми функциями SelSup из вашей системы. Для использования API добавьте новый токен на странице:https://selsup.ru/application/integration/api. Добавленный токен необходимо передавать во всех запросах к API SelSup, в заголовке Authorization.",
    "contact": {
      "name": "Support Team",
      "email": "admin@selsup.ru"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "https://selsup.ru/dogovor-offerta/"
    },
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.selsup.ru/",
      "description": "Production server"
    }
  ],
  "tags": [
    {
      "name": "Производители",
      "description": "Производитель обязательно указывается у каждого товара, если вы не передадите производителя, он будет создан автоматически"
    }
  ],
  "paths": {
    "/api/manufacturer/{manufacturerId}": {
      "get": {
        "tags": [
          "Производители"
        ],
        "summary": "Информация о производителе",
        "description": "Позволяет получить производителя по идентификатору",
        "operationId": "getManufacturerById",
        "parameters": [
          {
            "name": "manufacturerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/Manufacturer"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Производители"
        ],
        "summary": "Изменить производителя",
        "description": "Позволяет изменить данные о производителе для товаров",
        "operationId": "updateManufacturer",
        "parameters": [
          {
            "name": "manufacturerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Manufacturer"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/Manufacturer"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Производители"
        ],
        "summary": "Удалить производителя",
        "description": "Удаляет производителя или помечает его удаленным",
        "operationId": "removeManufacturer",
        "parameters": [
          {
            "name": "manufacturerId",
            "in": "path",
            "description": "Идентификатор производителя",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "deleted",
            "in": "query",
            "description": "Удалить или восстановить производителя",
            "required": true,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/manufacturer": {
      "post": {
        "tags": [
          "Производители"
        ],
        "summary": "Создать производителя",
        "description": "Позволяет добавить нового производителя для товаров",
        "operationId": "createManufacturer",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Manufacturer"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/Manufacturer"
                }
              }
            }
          }
        }
      }
    },
    "/api/manufacturer/find": {
      "get": {
        "tags": [
          "Производители"
        ],
        "summary": "Поиск производителя",
        "description": "Позволяет найти производителя для товаров",
        "operationId": "find",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "description": "Поиск по названию производителя",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Поиск по названию производителя"
            }
          },
          {
            "name": "manufacturerOneCId",
            "in": "query",
            "description": "Идентификатор производителя в 1С",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Идентификатор производителя в 1С"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Ограничение на количество записей. Максимальное значение - 500",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Ограничение на количество записей. Максимальное значение - 500",
              "format": "int32"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Номер страницы начиная с 1",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Номер страницы начиная с 1",
              "format": "int32"
            }
          },
          {
            "name": "count",
            "in": "query",
            "description": "Возвратить в ответе общее количество записей",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Возвратить в ответе общее количество записей"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "description": "Поле для сортировки",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Поле для сортировки",
              "enum": [
                "MANUFACTURERID",
                "NAME"
              ]
            }
          },
          {
            "name": "ascending",
            "in": "query",
            "description": "Порядок сортировки - по возрастанию?. Работает только при получении списка.",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Порядок сортировки - по возрастанию?. Работает только при получении списка."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/FindResponseManufacturer"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Manufacturer": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "manufacturerId": {
            "type": "integer",
            "description": "Идентификатор производителя. Генерируется автоматически",
            "format": "int32"
          },
          "title": {
            "type": "string",
            "description": "Название производителя внешнее для печати"
          },
          "name": {
            "type": "string",
            "description": "Название производителя внутреннее"
          },
          "address": {
            "type": "string",
            "description": "Адрес производителя производителя внутреннее"
          },
          "organizationId": {
            "type": "integer",
            "description": "Связь производителя с организацией - контрагентом",
            "format": "int64"
          },
          "clientId": {
            "type": "integer",
            "description": "Идентификатор клиента",
            "format": "int64",
            "readOnly": true
          },
          "countryId": {
            "type": "integer",
            "description": "Идентификатор страны",
            "format": "int32"
          },
          "countryName": {
            "type": "string",
            "description": "Название страны",
            "readOnly": true
          },
          "inn": {
            "type": "string",
            "description": "ИНН производителя, используется в основном для Честного знака"
          },
          "deleted": {
            "type": "boolean",
            "description": "Если true - производитель удален"
          },
          "oneCId": {
            "type": "string",
            "description": "Идентификатор в 1С"
          }
        },
        "description": "Производитель"
      },
      "FindResponseManufacturer": {
        "type": "object",
        "properties": {
          "rows": {
            "type": "array",
            "description": "Строки с результатом поиска",
            "items": {
              "$ref": "#/components/schemas/Manufacturer"
            }
          },
          "total": {
            "type": "integer",
            "description": "Общее количество найденных записей. Возвращается только, когда count = true",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "description": "Номер запрошенной страницы",
            "format": "int32"
          },
          "hasNextPage": {
            "type": "boolean",
            "description": "Есть ли следующая страница"
          },
          "emptyPurchase": {
            "type": "integer",
            "description": "Показатель пустой закупочной цены",
            "format": "int64"
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header"
      }
    }
  }
}