{
  "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/competitor/{competitorId}": {
      "put": {
        "tags": [
          "Конкуренты"
        ],
        "summary": "Редактировать карточку конкурента",
        "description": "Редактировать карточку конкурента по его id",
        "operationId": "update",
        "parameters": [
          {
            "name": "competitorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Competitor"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Конкуренты"
        ],
        "summary": "Удалить карточку конкурента",
        "description": "Удалить карточку конкурента по его id",
        "operationId": "delete",
        "parameters": [
          {
            "name": "competitorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/competitor/{modelId}": {
      "get": {
        "tags": [
          "Конкуренты"
        ],
        "summary": "Получить список всех конкурентов для модели",
        "description": "Получить список всех конкурентов для модели по ее id",
        "operationId": "getAll",
        "parameters": [
          {
            "name": "modelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Competitor"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Конкуренты"
        ],
        "summary": "Создать связь с карточкой конкурента",
        "description": "Создать модель конкурента, связывая его с карточкой конкурента",
        "operationId": "create",
        "parameters": [
          {
            "name": "modelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Competitor"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/Competitor"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Competitor": {
        "required": [
          "service",
          "url"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "ID конкурента",
            "format": "int64",
            "readOnly": true
          },
          "modelId": {
            "type": "integer",
            "description": "ID модели, для которой указывается конкурент",
            "format": "int64"
          },
          "service": {
            "type": "string",
            "description": "Сервис",
            "enum": [
              "NONE",
              "WILDBERRIES",
              "OZON",
              "YANDEX_MARKET",
              "FAMILIYA",
              "NATIONAL_CATALOG",
              "ALIEXPRESS",
              "OTHER",
              "MOY_SKLAD",
              "SBER_MEGA_MARKET",
              "CISLINK",
              "ONE_C",
              "AVITO",
              "LEROY_MERLIN",
              "DETMIR",
              "KAZAN_EXPRESS",
              "EVOTOR",
              "WEBASYST",
              "AMAZON",
              "EBAY",
              "SIMALAND",
              "INSALES",
              "LAMODA",
              "OZON_PERFORMANCE",
              "WALMART",
              "GOOGLE",
              "YANDEX_DISC",
              "EMAIL",
              "WOOCOMMERCE"
            ]
          },
          "url": {
            "type": "string",
            "description": "URL карточки конкурента на маркетплейсе"
          },
          "serviceId": {
            "type": "string",
            "description": "ID карточки конкурента на сайте маркетплейса"
          },
          "clientId": {
            "type": "integer",
            "description": "ID клиента",
            "format": "int64",
            "readOnly": true
          }
        },
        "description": "Карточка конкурента для модели товара"
      }
    },
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header"
      }
    }
  }
}