{
  "openapi": "3.1.0",
  "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/hypothesis/": {
      "post": {
        "tags": [
          "Тестирование гипотез"
        ],
        "summary": "Создать гипотезу",
        "description": "Позволяет создать новую гипотезу",
        "operationId": "hypothesis",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Hypothesis"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/Hypothesis"
                }
              }
            }
          }
        }
      }
    },
    "/api/hypothesis/{id}": {
      "get": {
        "tags": [
          "Тестирование гипотез"
        ],
        "summary": "Получить гипотезу",
        "description": "Позволяет получить гипотезу по ID",
        "operationId": "id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/Hypothesis"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Тестирование гипотез"
        ],
        "summary": "Удалить гипотезу",
        "description": "Позволяет удалить гипотезу",
        "operationId": "deleteHypothesis",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "Тестирование гипотез"
        ],
        "summary": "Изменить гипотезу",
        "description": "Позволяет изменить гипотезу",
        "operationId": "patchHypothesis",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Hypothesis"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/Hypothesis"
                }
              }
            }
          }
        }
      }
    },
    "/api/hypothesis/find": {
      "get": {
        "tags": [
          "Тестирование гипотез"
        ],
        "summary": "Поиск гипотез",
        "description": "Позволяет получить список гипотез",
        "operationId": "find",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "modelId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "service",
            "in": "query",
            "required": false,
            "schema": {
              "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",
                "MAGNIT",
                "OPENCART",
                "M_VIDEO",
                "TAKEALOT",
                "UZUM",
                "SHOPIFY"
              ]
            }
          },
          {
            "name": "endDateFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "endDateTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Ограничение на количество записей. Максимальное значение - 500",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "description": "Ограничение на количество записей. Максимальное значение - 500"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Номер страницы начиная с 1",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "description": "Номер страницы начиная с 1"
            }
          },
          {
            "name": "count",
            "in": "query",
            "description": "Возвратить в ответе общее количество записей",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Возвратить в ответе общее количество записей"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "description": "Поле для сортировки",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Поле для сортировки",
              "enum": [
                "ID",
                "NAME",
                "CREATEDDATE",
                "CREATEDUSER",
                "STARTDATE",
                "ENDDATE",
                "PREVIOUSSTARTDATE",
                "SUCCESSSTATUS"
              ]
            }
          },
          {
            "name": "ascending",
            "in": "query",
            "description": "Порядок сортировки - по возрастанию?. Работает только при получении списка.",
            "required": false,
            "schema": {
              "type": "boolean",
              "description": "Порядок сортировки - по возрастанию?. Работает только при получении списка."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/hal+json": {
                "schema": {
                  "$ref": "#/components/schemas/FindResponseHypothesis"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Hypothesis": {
        "type": "object",
        "description": "Гипотеза - метка времени для отслеживания экспериментов",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Название гипотезы"
          },
          "previousStartDate": {
            "type": "string",
            "format": "date-time",
            "description": "Начало предыдущего периода для сравнения"
          },
          "startDate": {
            "type": "string",
            "format": "date-time",
            "description": "Дата начала гипотезы"
          },
          "endDate": {
            "type": "string",
            "format": "date-time",
            "description": "Дата окончания гипотезы"
          },
          "modelId": {
            "type": "integer",
            "format": "int64",
            "description": "Модель, в которой создана гипотеза"
          },
          "modelArticle": {
            "type": "string",
            "description": "Артикул модели, в которой создана гипотеза"
          },
          "viewId": {
            "type": "integer",
            "format": "int64",
            "description": "Идентификатор цвета"
          },
          "productId": {
            "type": "integer",
            "format": "int64",
            "description": "Идентификатор товара"
          },
          "organizationId": {
            "type": "integer",
            "format": "int64",
            "description": "Идентификатор организации"
          },
          "createdDate": {
            "type": "string",
            "format": "date-time",
            "description": "Дата создания"
          },
          "createdUser": {
            "type": "string",
            "description": "Логин пользователя, создавшего гипотезу"
          },
          "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",
              "MAGNIT",
              "OPENCART",
              "M_VIDEO",
              "TAKEALOT",
              "UZUM",
              "SHOPIFY"
            ]
          },
          "successStatus": {
            "type": "string",
            "description": "Статус",
            "enum": [
              "NONE",
              "SUCCESSFUL",
              "UNSUCCESSFUL"
            ]
          }
        }
      },
      "FindResponseHypothesis": {
        "type": "object",
        "properties": {
          "rows": {
            "type": "array",
            "description": "Строки с результатом поиска",
            "items": {
              "$ref": "#/components/schemas/Hypothesis"
            }
          },
          "total": {
            "type": "integer",
            "format": "int32",
            "description": "Общее количество найденных записей. Возвращается только, когда count = true"
          },
          "page": {
            "type": "integer",
            "format": "int32",
            "description": "Номер запрошенной страницы"
          },
          "hasNextPage": {
            "type": "boolean",
            "description": "Есть ли следующая страница"
          },
          "emptyPurchase": {
            "type": "integer",
            "format": "int64",
            "description": "Показатель пустой закупочной цены"
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header"
      }
    }
  }
}