{
  "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/brand/{brandId}": {
      "get": {
        "tags": [
          "Бренды"
        ],
        "summary": "Бренд по идентификатору",
        "description": "Возвращает бренд по идентификатору",
        "operationId": "getBrandById",
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "description": "Идентификатор бренда",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "Идентификатор бренда",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/Brand"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Бренды"
        ],
        "summary": "Изменить бренд",
        "description": "Позволяет изменить информацию о бренде",
        "operationId": "updateBrand",
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Brand"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/Brand"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Бренды"
        ],
        "summary": "Удалить бренд",
        "description": "Удаляет бренда или помечает его удаленным",
        "operationId": "removeBrand",
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "description": "Идентификатор бренда",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "Идентификатор бренда",
              "format": "int32"
            }
          },
          {
            "name": "deleted",
            "in": "query",
            "description": "Позволяет восстановить товар из удаленных,если передать deleted=false",
            "required": true,
            "schema": {
              "type": "boolean",
              "description": "Позволяет восстановить товар из удаленных,если передать deleted=false"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/brand": {
      "post": {
        "tags": [
          "Бренды"
        ],
        "summary": "Создать бренд",
        "description": "Позволяет добавить нового бренда или торговую марку. При создании нового бренда достаточно указать только название. ID бренда в Ozon необходимо только, если вы хотите создавать новые карточки в Ozon и не будете запускать импорт",
        "operationId": "createBrand",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Brand"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/Brand"
                }
              }
            }
          }
        }
      }
    },
    "/api/brand/{brandId}/merge/{removeBrandId}": {
      "post": {
        "tags": [
          "Бренды"
        ],
        "summary": "Объединение брендов",
        "description": "Позволяет объединить два бренда - оставив только одного",
        "operationId": "mergeBrands",
        "parameters": [
          {
            "name": "brandId",
            "in": "query",
            "description": "ID бренда на который перенести все данные",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "ID бренда на который перенести все данные",
              "format": "int32"
            }
          },
          {
            "name": "removeBrandId",
            "in": "query",
            "description": "ID бренда, который будет удален",
            "required": true,
            "schema": {
              "type": "integer",
              "description": "ID бренда, который будет удален",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/brand/{brandId}/image": {
      "post": {
        "tags": [
          "Бренды"
        ],
        "summary": "Загрузить логотип бренда",
        "description": "Позволяет загрузить новый логотип бренда",
        "operationId": "uploadBrandImage",
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": [
                  "file"
                ],
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "description": "Бинарный файл изображения с логотипом бренда в multipart form. Поддерживаются все основные форматы изображений",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/Brand"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Бренды"
        ],
        "summary": "Удалить логотип бренда",
        "description": "Позволяет удалить логотип бренда",
        "operationId": "removeBrandImage",
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/Brand"
                }
              }
            }
          }
        }
      }
    },
    "/api/brand/find": {
      "get": {
        "tags": [
          "Бренды"
        ],
        "summary": "Поиск бренда",
        "description": "Позволяет найти бренд по фильтру",
        "operationId": "findBrand",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "description": "Поиск по названию бренда",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Поиск по названию бренда"
            }
          },
          {
            "name": "deleted",
            "in": "query",
            "description": "Бренд удален?",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Бренд удален?"
            }
          },
          {
            "name": "brandOneCId",
            "in": "query",
            "description": "Идентификатор бренда в 1С",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Идентификатор бренда в 1С"
            }
          },
          {
            "name": "hasOzonId",
            "in": "query",
            "description": "Наличие ID Ozon?",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Наличие ID Ozon?"
            }
          },
          {
            "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": [
                "NAME",
                "BRANDID"
              ]
            }
          },
          {
            "name": "ascending",
            "in": "query",
            "description": "Порядок сортировки - по возрастанию?. Работает только при получении списка.",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Порядок сортировки - по возрастанию?. Работает только при получении списка."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/FindResponseBrand"
                }
              }
            }
          }
        }
      }
    },
    "/api/brand/all": {
      "get": {
        "tags": [
          "Бренды"
        ],
        "summary": "Список всех брендов клиента",
        "description": "Возвращает список всех брендов",
        "operationId": "fetchAllBrands",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Brand"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Brand": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "brandId": {
            "type": "integer",
            "description": "Идентификатор бренда",
            "format": "int32",
            "readOnly": true
          },
          "name": {
            "type": "string",
            "description": "Название бренда"
          },
          "clientId": {
            "type": "integer",
            "description": "Идентификатор клиента",
            "format": "int64",
            "readOnly": true
          },
          "logo": {
            "type": "string",
            "description": "Путь к логотипу бренда в /files/",
            "readOnly": true
          },
          "logoUrl": {
            "type": "string",
            "description": "Ссылка логотипа бренда",
            "readOnly": true
          },
          "logoSize": {
            "type": "integer",
            "description": "Размер логотипа в байтах",
            "format": "int32",
            "readOnly": true
          },
          "logoWidth": {
            "type": "integer",
            "description": "Ширина логотипа в пикселях",
            "format": "int32",
            "readOnly": true
          },
          "logoHeight": {
            "type": "integer",
            "description": "Высота логотипа в пикселях",
            "format": "int32",
            "readOnly": true
          },
          "deleted": {
            "type": "boolean",
            "description": "Бренд удален?"
          },
          "ozonName": {
            "type": "string",
            "description": "Название бренда на Ozon"
          },
          "ozonId": {
            "type": "integer",
            "description": "ID бренда на Ozon",
            "format": "int64"
          },
          "oneCId": {
            "type": "string",
            "description": "Идентификатор 1С"
          }
        },
        "description": "Бренд"
      },
      "FindResponseBrand": {
        "type": "object",
        "properties": {
          "rows": {
            "type": "array",
            "description": "Строки с результатом поиска",
            "items": {
              "$ref": "#/components/schemas/Brand"
            }
          },
          "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"
      }
    }
  }
}