Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
  • RESTfull JSON API
  • RESTfull JSON API

    Доступно с версии 0.84

    Рекомендуемая минимальная версия для использования 1.00

    Table of Contents
    maxLevel3

    Children Display
    sortcreation


    Warning

    В данный момент находиться находится в процессе активной разработки

    API может (и будет) дополняться и изменяться в будущем

    Warning
    titleВерсия

    Доступно с версии 0.84 и вышепостоянно расширяется и изменяется, следите за новыми версиями

    Общая информация

    Подключение

    Code Block
    $conf{API_ENABLE} = 1;

    Конфигурация

    В системе реализован RESTfull RESTful интерфейс управления услугами и абонентами. Интерфейс находит по адресу /api.cgi. Оправка
    Отправка, получение данных производится по протоколу HTTP POST/GET/PUT/DELETE. Все взаимодействие по интерфейсу выполняется по принципам REST (ресурс определяться по средствам задания имени в URL).

    Для сохранение совместимости с стандартом REST все ключи автоматически переводятся в camelCaseв camelCase, но поскольку несоответствие названий в Базе Данных базе данных может усложнить разработку – существует – существует возможность отключить такое превращение используя несколько вариантов:

    1. Параметр $conf{API_FILDS_CAMELIZE} в конфигурационном файле
    2. Задать в заголовках запроса CAMELIZE в соответствующие значение (имеет приоритет над значением в конфигурационном файле)параметрах snakeCase=1 в GET или в POST "snakeCase": "1"
    ЗначениеРезультат
    1Все ключи превращаются в camelCase
    0Ключи в исходном виде, как в базе данных (snake_case)

    Авторизация

    Для подтверждения личности при выполнении запросов, некоторые пути требуют соответствующий привилегии:

    • Авторизация администратора выполняется через API_KEY (можно задать в веб-интерфейсе). Ключ нужно передать в заголовке запроса KEY в значении API_KEY.
    • Пользователям нужно использовать идентификатор сессии (sid), передавая его значение в заголовке USERSID. Для получения sid можно
      воспользоваться авторизацией через API используя маршрут авторизация абонента (/users/login).


    AnchorAPI администратораAPI администратора
    Open API (Swagger) Integration for Confluence
    {
      "swagger": "2.0",
      "info": {
        "version": "1.0.0",
        "title": "Abills admins API"
      },
      "host": "demo.abills.net.ua:9443",
      "basePath": "/api.cgi",
      "tags": [
        {
          "name": "users",
          "description": "Работа с пользователями"
        },
        {
          "name": "groups",
          "description": "Группы пользователей"
        },
        {
          "name": "tp",
          "description": "Тарифные планы"
        },
        {
          "name": "msgs",
          "description": "Msgs"
        },
        {
          "name": "internet",
          "description": "Internet"
        },
        {
          "name": "iptv",
          "description": "Iptv"
        },
        {
          "name": "abon",
          "description": "Abon"
        },
        {
          "name": "districts",
          "description": "Районы"
        },
        {
          "name": "streets",
          "description": "Улицы"
        },
        {
          "name": "builds",
          "description": "Дома"
        },
        {
          "name": "payments",
          "description": "Оплаты"
        },
        {
          "name": "fees",
          "description": "Списания"
        },
        {
          "name": "online",
          "description": "Сессии пользователя"
        },
        {
          "name": "version",
          "description": "Версии"
        }
      ],
      "schemes": [
        "https"
      ],
      "paths": {
        "/users/login": {
          "post": {
            "tags": [
              "users"
            ],
            "summary": "Авторизация пользователя",
            "operationId": "loginUser",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/UserLogin"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/inline_response_200"
                }
              }
            }
          }
        },
        "/users/": {
          "post": {
            "tags": [
              "users"
            ],
            "summary": "Добавить нового пользователя",
            "operationId": "addUser",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "in": "body",
                "name": "body",
                "description": "Параметры, которые нужно указать",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/User"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/UserCreated"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/users/{UID}": {
          "get": {
            "tags": [
              "users"
            ],
            "summary": "Получить пользователя по UID",
            "description": "Возвращает пользователя",
            "operationId": "getUserByUID",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя в биллинге",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/User"
                }
              },
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "put": {
            "tags": [
              "users"
            ],
            "summary": "Обновить информацию о пользователе",
            "operationId": "updateUser",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователь",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/User"
                }
              }
            ],
            "responses": {
              "400": {
                "description": "Invalid ID supplied"
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "delete": {
            "tags": [
              "users"
            ],
            "summary": "Удалить пользователя",
            "operationId": "deleteUser",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/users/{UID}/pi": {
          "get": {
            "tags": [
              "users"
            ],
            "summary": "Получить персональную информацию о пользователе",
            "description": "Возвращает персональную информацию пользователя",
            "operationId": "getUserPiByUID",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя в биллинге",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/UserPi"
                }
              },
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "post": {
            "tags": [
              "users"
            ],
            "summary": "Добавление персональной информации пользователю",
            "operationId": "addUserPi",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователь",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/UserPi"
                }
              }
            ],
            "responses": {
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "put": {
            "tags": [
              "users"
            ],
            "summary": "Изменение персональной информации пользователю",
            "operationId": "changeUserPi",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователь",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/UserPi"
                }
              }
            ],
            "responses": {
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/users/{UID}/contacts": {
          "get": {
            "tags": [
              "users"
            ],
            "summary": "Получить контакты пользователя по UID",
            "description": "Возвращает контакты пользователя",
            "operationId": "getUserContactsByUID",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя в биллинге",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/ContactsArray"
                }
              },
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "post": {
            "tags": [
              "users"
            ],
            "summary": "Добавление контакта пользователю",
            "operationId": "updateUserContact",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователь",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/User"
                }
              }
            ],
            "responses": {
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/users/{UID}/contacts/{ID}": {
          "put": {
            "tags": [
              "users"
            ],
            "summary": "Обновить контакт пользователю",
            "operationId": "updateUserConctact",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователь",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "name": "ID",
                "in": "path",
                "description": "ID контакта",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "delete": {
            "tags": [
              "users"
            ],
            "summary": "Удалить контакт пользователя",
            "operationId": "deleteUserContact",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "name": "ID",
                "in": "path",
                "description": "ID контакта",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/users/contacts": {
          "post": {
            "tags": [
              "users"
            ],
            "summary": "Получить контакты",
            "description": "Возвращает контакты пользователей",
            "operationId": "getContacts",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "in": "body",
                "name": "body",
                "description": "Параметры для фильтрации контактов",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/Contacts"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/ContactsArray"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/users/{UID}/internet": {
          "get": {
            "tags": [
              "internet"
            ],
            "summary": "Получить список ТП Internet пользователя",
            "description": "Возвращает ТП интернет пользователя",
            "operationId": "getUserInternetByUID",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя в биллинге",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/UserInternetList"
                }
              },
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "post": {
            "tags": [
              "internet"
            ],
            "summary": "Добавление ТП Internet пользователю",
            "operationId": "addUserInternet",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователь",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/UserInternet"
                }
              }
            ],
            "responses": {
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/users/{UID}/internet/{ID}": {
          "get": {
            "tags": [
              "internet"
            ],
            "summary": "Информация об интернет услуге пользователя по ID услуги",
            "operationId": "internetInfoUser",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователь",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "name": "ID",
                "in": "path",
                "description": "ID услуги",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/users/{UID}/iptv": {
          "get": {
            "tags": [
              "iptv"
            ],
            "summary": "Получить список ТП Iptv пользователя",
            "description": "Возвращает ТП Iptv пользователя",
            "operationId": "getUserIptvByUID",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя в биллинге",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/UserIptvList"
                }
              },
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/users/{UID}/iptv/{ID}": {
          "get": {
            "tags": [
              "iptv"
            ],
            "summary": "Информация об Iptv услуге пользователя по ID услуги",
            "operationId": "iptvInfoUser",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователь",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "name": "ID",
                "in": "path",
                "description": "ID услуги",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/msgs/": {
          "post": {
            "tags": [
              "msgs"
            ],
            "summary": "Добавить сообщение",
            "operationId": "addMsgs",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "in": "body",
                "name": "body",
                "description": "Параметры, которые нужно указать",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/Msgs"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/ApiSuccessAddResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/msgs/{ID}": {
          "get": {
            "tags": [
              "msgs"
            ],
            "summary": "Получить сообщение по ID",
            "description": "Возвращает сообщение",
            "operationId": "getMsgsInfoByID",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "ID",
                "in": "path",
                "description": "ID сообщения",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/Msgs"
                }
              },
              "404": {
                "description": "Сообщение не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/msgs/list": {
          "post": {
            "tags": [
              "msgs"
            ],
            "summary": "Получить список сообщений",
            "operationId": "msgsList",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "in": "body",
                "name": "body",
                "description": "Параметры, по которым можно фильтровать сообщения",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/Msgs"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/ApiSuccessAddResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/msgs/{ID}/reply": {
          "get": {
            "tags": [
              "msgs"
            ],
            "summary": "Ответы на сообщение",
            "operationId": "repliesListToMsgs",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "ID",
                "in": "path",
                "description": "ID сообщения",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/MsgsRepliesList"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "post": {
            "tags": [
              "msgs"
            ],
            "summary": "Ответить на сообщение",
            "operationId": "addReplyToMsgs",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "ID",
                "in": "path",
                "description": "ID сообщения",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "in": "body",
                "name": "body",
                "description": "Параметры, которые нужно указать",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/MsgsReply"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/ApiSuccessAddResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/msgs/reply/{REPLY_ID}/attachment": {
          "post": {
            "tags": [
              "msgs"
            ],
            "summary": "Прикрепление файла к ответу",
            "operationId": "addAttachmentToReply",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "REPLY_ID",
                "in": "path",
                "description": "ID ответа на сообщение",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "in": "body",
                "name": "body",
                "description": "Параметры, которые нужно указать",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/MsgsReplyAttachment"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/ApiSuccessAddResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/msgs/chapters": {
          "get": {
            "tags": [
              "msgs"
            ],
            "summary": "Получить список разделов",
            "operationId": "chaptersList",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [],
            "responses": {
              "200": {
                "description": "успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/MsgsChapter"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/groups": {
          "get": {
            "tags": [
              "groups"
            ],
            "summary": "Получить группы пользователей",
            "description": "Возвращает группы пользователей",
            "operationId": "getGroupsList",
            "produces": [
              "application/json"
            ],
            "parameters": [],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/Groups"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/tp/{tpID}": {
          "get": {
            "tags": [
              "tp"
            ],
            "summary": "Получить информацию по тарифному плану",
            "description": "Возвращает тарифный план",
            "operationId": "getTpInfo",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "tpID",
                "in": "path",
                "description": "tpID тарифного плана",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/Tp"
                }
              },
              "404": {
                "description": "Тарифный план не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/tp/{tpID}/intervals/": {
          "get": {
            "tags": [
              "tp"
            ],
            "summary": "Получить информацию по интервалам ТП",
            "description": "Возвращает интервалы ТП",
            "operationId": "getTpIntervalsInfo",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "tpID",
                "in": "path",
                "description": "tpID тарифного плана",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/TpIntervals"
                }
              },
              "404": {
                "description": "Тарифный план не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/districts": {
          "get": {
            "tags": [
              "districts"
            ],
            "summary": "Получить районы",
            "description": "Возвращает список районов",
            "operationId": "getDistricts",
            "produces": [
              "application/json"
            ],
            "parameters": [],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/DistrictsArray"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "post": {
            "tags": [
              "districts"
            ],
            "summary": "Добавление района",
            "operationId": "addDistrict",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/Districts"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/ApiSuccessAddResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/districts/{ID}": {
          "get": {
            "tags": [
              "districts"
            ],
            "summary": "Получить информацию о районе",
            "operationId": "getDistrictInfo",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "ID",
                "in": "path",
                "description": "ID района",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/Districts"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "put": {
            "tags": [
              "districts"
            ],
            "summary": "Обновить информацию о районе",
            "operationId": "updateDistrict",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "ID",
                "in": "path",
                "description": "ID района",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/Districts"
                }
              }
            ],
            "responses": {
              "400": {
                "description": "Invalid ID supplied"
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/streets": {
          "get": {
            "tags": [
              "streets"
            ],
            "summary": "Получить улицы",
            "description": "Возвращает список улиц",
            "operationId": "getStreets",
            "produces": [
              "application/json"
            ],
            "parameters": [],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/StreetsArray"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "post": {
            "tags": [
              "streets"
            ],
            "summary": "Добавление района",
            "operationId": "addStreet",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/Streets"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/ApiSuccessAddResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/streets/{ID}": {
          "get": {
            "tags": [
              "streets"
            ],
            "summary": "Получить информацию о улице",
            "description": "Возвращает улицу",
            "operationId": "getStreetInfo",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "ID",
                "in": "path",
                "description": "ID улицы",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/Streets"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "put": {
            "tags": [
              "streets"
            ],
            "summary": "Обновить информацию о улице",
            "operationId": "updateStreet",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "ID",
                "in": "path",
                "description": "ID улицы",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/Streets"
                }
              }
            ],
            "responses": {
              "400": {
                "description": "Invalid ID supplied"
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/builds": {
          "get": {
            "tags": [
              "builds"
            ],
            "summary": "Получить дома",
            "description": "Возвращает список домов",
            "operationId": "getBuilds",
            "produces": [
              "application/json"
            ],
            "parameters": [],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/BuildsArray"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "post": {
            "tags": [
              "builds"
            ],
            "summary": "Добавление дома",
            "operationId": "addBuild",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/Builds"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/ApiSuccessAddResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/builds/{ID}": {
          "get": {
            "tags": [
              "builds"
            ],
            "summary": "Получить информацию о доме",
            "description": "Возвращает дом",
            "operationId": "getBuildInfo",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "ID",
                "in": "path",
                "description": "ID дома",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/Builds"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "put": {
            "tags": [
              "builds"
            ],
            "summary": "Обновить информацию о доме",
            "operationId": "updateBuild",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "ID",
                "in": "path",
                "description": "ID дома",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/Builds"
                }
              }
            ],
            "responses": {
              "400": {
                "description": "Invalid ID supplied"
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/payments/types": {
          "get": {
            "tags": [
              "payments"
            ],
            "summary": "Получить список типов оплат",
            "description": "Возвращает список типов оплат",
            "operationId": "getPaymentTypesList",
            "produces": [
              "application/json"
            ],
            "parameters": [],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/PaymentTypesArray"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/payments/users/{UID}": {
          "get": {
            "tags": [
              "payments"
            ],
            "summary": "Получить список оплат пользователя",
            "description": "Возвращает список оплат пользователя",
            "operationId": "getUserPayments",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/UserPaymentsArray"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "post": {
            "tags": [
              "payments"
            ],
            "summary": "Добавление оплаты пользователю",
            "operationId": "addUserPayment",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/UserPaymentAdd"
                }
              }
            ],
            "responses": {
              "400": {
                "description": "Invalid ID supplied"
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/fees/types": {
          "get": {
            "tags": [
              "fees"
            ],
            "summary": "Получить список типов списания",
            "description": "Возвращает список типов списания",
            "operationId": "getFeesTypesList",
            "produces": [
              "application/json"
            ],
            "parameters": [],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/FeesTypesArray"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/fees/users/{UID}": {
          "get": {
            "tags": [
              "fees"
            ],
            "summary": "Получить список списаний пользователя",
            "description": "Возвращает список списаний пользователя",
            "operationId": "getUserFees",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/UserFeesArray"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/fees/users/{UID}/{SUM}": {
          "post": {
            "tags": [
              "fees"
            ],
            "summary": "Добавление списания пользователю",
            "operationId": "addUserFee",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "name": "SUM",
                "in": "path",
                "description": "Сумма списания",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/UserFeeAdd"
                }
              }
            ],
            "responses": {
              "400": {
                "description": "Invalid ID supplied"
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/abon/tariffs": {
          "get": {
            "tags": [
              "abon"
            ],
            "summary": "Получить список ТП",
            "description": "Возвращает список ТП",
            "operationId": "getAbonTps",
            "produces": [
              "application/json"
            ],
            "parameters": [],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/AbonTpsArray"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "post": {
            "tags": [
              "abon"
            ],
            "summary": "Добавление ТП",
            "operationId": "addAbonTp",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "in": "body",
                "name": "body",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/AbonAddTp"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/ApiSuccessAddResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/abon/tariffs/{ID}": {
          "get": {
            "tags": [
              "abon"
            ],
            "summary": "Получить информацию о ТП",
            "description": "Возвращает информацию о ТП",
            "operationId": "getAbonTp",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "ID",
                "in": "path",
                "description": "ID ТП",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/AbonTp"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/abon/tariffs/{ID}/users/{UID}": {
          "post": {
            "tags": [
              "abon"
            ],
            "summary": "Добавление ТП пользователю",
            "operationId": "addAbonTpToUser",
            "consumes": [
              "application/json"
            ],
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "ID",
                "in": "path",
                "description": "ID ТП",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/ApiSuccessAddResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          },
          "delete": {
            "tags": [
              "abon"
            ],
            "summary": "Удаление ТП пользователя",
            "description": "Удаление ТП пользователя",
            "operationId": "getUserAbonTps",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "ID",
                "in": "path",
                "description": "ID ТП",
                "required": true,
                "type": "integer",
                "format": "int64"
              },
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение"
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/abon/users": {
          "get": {
            "tags": [
              "abon"
            ],
            "summary": "Получить список пользователей Abon",
            "description": "Возвращает список пользователей Abon",
            "operationId": "getUsersAbon",
            "produces": [
              "application/json"
            ],
            "parameters": [],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/AbonUsersArray"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/online/{UID}": {
          "get": {
            "tags": [
              "online"
            ],
            "summary": "Получить сессии пользователя по UID",
            "description": "Возвращает сессии пользователя",
            "operationId": "getUserSessions",
            "produces": [
              "application/json"
            ],
            "parameters": [
              {
                "name": "UID",
                "in": "path",
                "description": "UID пользователя в биллинге",
                "required": true,
                "type": "integer",
                "format": "int64"
              }
            ],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/OnlineSessionsArray"
                }
              },
              "404": {
                "description": "Пользователь не найден",
                "schema": {
                  "$ref": "#/definitions/ApiResponse"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        },
        "/version": {
          "get": {
            "tags": [
              "version"
            ],
            "summary": "Получить версии биллинга и API",
            "operationId": "getVersion",
            "produces": [
              "application/json"
            ],
            "parameters": [],
            "responses": {
              "200": {
                "description": "Успешное выполнение",
                "schema": {
                  "$ref": "#/definitions/Version"
                }
              }
            },
            "security": [
              {
                "KEY": []
              }
            ]
          }
        }
      },
      "securityDefinitions": {
        "KEY": {
          "type": "apiKey",
          "name": "KEY",
          "in": "header"
        }
      },
      "definitions": {
        "User": {
          "type": "object",
          "properties": {
            "login": {
              "type": "string",
              "example": "testUser"
            },
            "password": {
              "type": "string",
              "example": "123456"
            },
            "createBill": {
              "type": "integer"
            }
          }
        },
        "UserPi": {
          "type": "object",
          "properties": {
            "fio": {
              "type": "string",
              "example": "Петренко",
              "description": "Фамилия"
            },
            "fio2": {
              "type": "string",
              "example": "Иван",
              "description": "Имя"
            },
            "fio3": {
              "type": "string",
              "example": "Петрович",
              "description": "Отчество"
            },
            "comments": {
              "type": "string"
            },
            "email": {
              "type": "string"
            },
            "phone": {
              "type": "string"
            }
          }
        },
        "UserCreated": {
          "type": "object",
          "properties": {
            "preAdd": {
              "type": "integer",
              "example": 1
            },
            "total": {
              "type": "integer",
              "example": 0
            },
            "insertId": {
              "type": "string",
              "example": "17"
            },
            "uid": {
              "type": "string",
              "example": "32"
            },
            "affected": {
              "type": "integer",
              "example": 1
            },
            "login": {
              "type": "string",
              "example": "testUser"
            }
          }
        },
        "UserInternetList": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/UserInternetList_inner"
          }
        },
        "UserInternet": {
          "type": "object",
          "properties": {
            "tpId": {
              "type": "integer",
              "example": 41
            },
            "cid": {
              "type": "string",
              "example": "14:11:11:11:11:c1"
            },
            "activate": {
              "type": "string",
              "example": "0000-00-00"
            },
            "expire": {
              "type": "string",
              "example": "0000-00-00"
            }
          }
        },
        "UserIptvList": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/UserIptvList_inner"
          }
        },
        "Contacts": {
          "type": "object",
          "properties": {
            "value": {
              "type": "string",
              "example": "test@gmail.com"
            },
            "type": {
              "type": "string",
              "example": "_SHOW",
              "description": "_SHOW - отобразить поле"
            },
            "typeName": {
              "type": "string",
              "example": "_SHOW"
            }
          }
        },
        "ContactsArray": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/ContactsArray_inner"
          }
        },
        "Tp": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 2
            },
            "tpId": {
              "type": "integer",
              "example": 83
            },
            "dayFee": {
              "type": "integer"
            },
            "monthFee": {
              "type": "integer"
            },
            "module": {
              "type": "string",
              "example": "Internet"
            },
            "changePrice": {
              "type": "integer"
            },
            "activPrice": {
              "type": "integer"
            },
            "serviceId": {
              "type": "integer"
            },
            "status": {
              "type": "integer"
            }
          }
        },
        "TpIntervals": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/TpIntervals_inner"
          }
        },
        "Groups": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Groups_inner"
          }
        },
        "Msgs": {
          "type": "object",
          "properties": {
            "uid": {
              "type": "integer",
              "example": 11135
            },
            "chapter": {
              "type": "integer",
              "example": 2
            },
            "message": {
              "type": "string",
              "example": "Test message"
            },
            "state": {
              "type": "integer",
              "example": 0
            },
            "subject": {
              "type": "string",
              "example": "Message subject"
            },
            "priority": {
              "type": "integer",
              "example": 2
            }
          }
        },
        "MsgsReply": {
          "type": "object",
          "properties": {
            "aid": {
              "type": "integer",
              "example": 2
            },
            "reply_text": {
              "type": "string",
              "example": "Reply text"
            }
          }
        },
        "MsgsRepliesList": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/MsgsRepliesList_inner"
          }
        },
        "MsgsReplyAttachment": {
          "type": "object",
          "properties": {
            "filename": {
              "type": "string",
              "example": "Test.txt"
            },
            "filesize": {
              "type": "integer",
              "example": 12
            },
            "content": {
              "type": "string",
              "example": "  Test content"
            },
            "content_type": {
              "type": "string",
              "example": "text/plain"
            },
            "message_type": {
              "type": "integer",
              "example": 1
            }
          }
        },
        "MsgsChapter": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/MsgsChapter_inner"
          }
        },
        "Districts": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "example": "пос.Зуевка"
            },
            "city": {
              "type": "string",
              "example": "Харцызск"
            },
            "zip": {
              "type": "string"
            }
          }
        },
        "DistrictsArray": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/DistrictsArray_inner"
          }
        },
        "Streets": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "example": "ул.Цэемовская"
            },
            "district_id": {
              "type": "integer",
              "example": 2
            },
            "second_name": {
              "type": "string"
            }
          }
        },
        "StreetsArray": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/StreetsArray_inner"
          }
        },
        "Builds": {
          "type": "object",
          "properties": {
            "street_id": {
              "type": "integer",
              "example": 2
            },
            "number": {
              "type": "string"
            }
          }
        },
        "BuildsArray": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/BuildsArray_inner"
          }
        },
        "PaymentTypesArray": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/PaymentTypesArray_inner"
          }
        },
        "UserPaymentsArray": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/UserPaymentsArray_inner"
          }
        },
        "UserPaymentAdd": {
          "type": "object",
          "properties": {
            "sum": {
              "type": "integer",
              "example": 500
            },
            "method": {
              "type": "integer",
              "example": 6
            },
            "bill_id": {
              "type": "integer",
              "example": 10
            }
          }
        },
        "FeesTypesArray": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/FeesTypesArray_inner"
          }
        },
        "UserFeesArray": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/UserFeesArray_inner"
          }
        },
        "UserFeeAdd": {
          "type": "object",
          "properties": {
            "method": {
              "type": "integer",
              "example": 6
            },
            "bill_id": {
              "type": "integer",
              "example": 10
            },
            "describe": {
              "type": "string"
            }
          }
        },
        "AbonTpsArray": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/AbonTpsArray_inner"
          }
        },
        "AbonAddTp": {
          "type": "object",
          "properties": {
            "price": {
              "type": "integer",
              "example": 100
            },
            "period": {
              "type": "integer",
              "example": 1
            },
            "name": {
              "type": "string",
              "example": "Test abon TP"
            },
            "description": {
              "type": "string",
              "example": "Test description"
            }
          }
        },
        "AbonTp": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 1
            },
            "name": {
              "type": "string",
              "example": "Test abon TP"
            },
            "price": {
              "type": "integer",
              "example": 100
            },
            "userPortal": {
              "type": "integer",
              "example": 0
            },
            "userCount": {
              "type": "integer",
              "example": 10
            },
            "discount": {
              "type": "integer",
              "example": 0
            },
            "paymentType": {
              "type": "integer",
              "example": 0
            },
            "periodAlignment": {
              "type": "integer",
              "example": 1
            },
            "nextAbonDate": {
              "type": "string",
              "example": "2021-10-01"
            },
            "description": {
              "type": "string"
            }
          }
        },
        "AbonUsersArray": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/AbonUsersArray_inner"
          }
        },
        "OnlineSessionsArray": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/OnlineSessionsArray_inner"
          }
        },
        "Version": {
          "type": "object",
          "properties": {
            "version": {
              "type": "string",
              "example": "0.91.0"
            },
            "apiVersion": {
              "type": "string",
              "example": "0.01"
            },
            "billing": {
              "type": "string",
              "example": "Abills"
            }
          }
        },
        "ApiResponse": {
          "type": "object",
          "properties": {
            "errstr": {
              "type": "string",
              "example": "ERROR_NOT_EXIST"
            },
            "errno": {
              "type": "integer",
              "example": 2
            }
          }
        },
        "ApiSuccessAddResponse": {
          "type": "object",
          "properties": {
            "total": {
              "type": "integer",
              "example": 0
            },
            "affected": {
              "type": "integer",
              "example": 1
            },
            "insertId": {
              "type": "integer",
              "example": 37
            }
          }
        },
        "UserLogin": {
          "type": "object",
          "properties": {
            "login": {
              "type": "string",
              "example": "testuser"
            },
            "password": {
              "type": "string",
              "example": "testuser"
            }
          }
        },
        "inline_response_200": {
          "type": "object",
          "properties": {
            "login": {
              "type": "string",
              "example": "testuser"
            },
            "sid": {
              "type": "string",
              "example": "sW44EJZLyWDMeXAV"
            },
            "uid": {
              "type": "string",
              "example": "5690"
            }
          }
        },
        "UserInternetList_inner": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 2
            },
            "tpName": {
              "type": "string",
              "example": "Премиум до 100м"
            },
            "tpId": {
              "type": "integer",
              "example": 41
            },
            "internetStatus": {
              "type": "integer",
              "example": 0
            },
            "cid": {
              "type": "string",
              "example": "14:11:11:11:11:c1"
            },
            "monthFee": {
              "type": "integer",
              "example": 250
            },
            "dayFee": {
              "type": "integer",
              "example": 0
            }
          }
        },
        "UserIptvList_inner": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 2
            },
            "tpName": {
              "type": "string",
              "example": "Премиум Iptvportal"
            },
            "tpId": {
              "type": "integer",
              "example": 41
            },
            "serviceStatus": {
              "type": "integer",
              "example": 0
            },
            "monthFee": {
              "type": "integer",
              "example": 250
            },
            "dayFee": {
              "type": "integer",
              "example": 0
            },
            "serviceId": {
              "type": "integer",
              "example": 0
            },
            "subscribeId": {
              "type": "integer",
              "example": 0
            },
            "filterId": {
              "type": "integer",
              "example": 0
            }
          }
        },
        "ContactsArray_inner": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 1
            },
            "uid": {
              "type": "string",
              "example": "132"
            },
            "value": {
              "type": "string",
              "example": "test@gmail.com"
            },
            "typeName": {
              "type": "string",
              "example": "Email"
            }
          }
        },
        "TpIntervals_inner": {
          "type": "object",
          "properties": {
            "begin": {
              "type": "string",
              "example": "00:00:00"
            },
            "end": {
              "type": "string",
              "example": "23:59:59"
            },
            "id": {
              "type": "integer",
              "example": 2
            },
            "tarif": {
              "type": "string"
            },
            "trafficClasses": {
              "type": "string"
            },
            "day": {
              "type": "integer"
            }
          }
        },
        "Groups_inner": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 53
            },
            "name": {
              "type": "string",
              "example": "Должники"
            },
            "descr": {
              "type": "string"
            },
            "domainId": {
              "type": "integer"
            },
            "disableChgTp": {
              "type": "integer",
              "example": 1
            }
          }
        },
        "MsgsRepliesList_inner": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 2
            },
            "text": {
              "type": "string",
              "example": "Reply text"
            },
            "aid": {
              "type": "integer",
              "example": 2
            },
            "admin": {
              "type": "string",
              "example": "abills"
            },
            "datetime": {
              "type": "string",
              "example": "2021-08-09 13:25:41"
            },
            "mainMsg": {
              "type": "integer",
              "example": 40
            }
          }
        },
        "MsgsChapter_inner": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 2
            },
            "name": {
              "type": "string",
              "example": "Первый раздел"
            },
            "responsible": {
              "type": "integer",
              "example": 1
            },
            "innerChapter": {
              "type": "integer",
              "example": 0
            },
            "autoclose": {
              "type": "integer",
              "example": 50
            }
          }
        },
        "DistrictsArray_inner": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 10
            },
            "name": {
              "type": "string",
              "example": "пос.Зуевка"
            },
            "city": {
              "type": "string",
              "example": "Харцызск"
            },
            "zip": {
              "type": "string"
            },
            "streetCount": {
              "type": "integer",
              "example": 31
            }
          }
        },
        "StreetsArray_inner": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 10
            },
            "streetName": {
              "type": "string",
              "example": "ул.Цэемовская"
            },
            "districtId": {
              "type": "integer",
              "example": 2
            },
            "buildCount": {
              "type": "integer",
              "example": 31
            }
          }
        },
        "BuildsArray_inner": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 10
            },
            "streetName": {
              "type": "string",
              "example": "ул.Цэемовская"
            },
            "streetId": {
              "type": "integer",
              "example": 2
            },
            "number": {
              "type": "string",
              "example": "31"
            }
          }
        },
        "PaymentTypesArray_inner": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 10
            },
            "name": {
              "type": "string",
              "example": "Credit card"
            },
            "feesType": {
              "type": "integer",
              "example": 0
            },
            "color": {
              "type": "string"
            }
          }
        },
        "UserPaymentsArray_inner": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 10
            },
            "sum": {
              "type": "integer",
              "example": 500
            },
            "regDate": {
              "type": "string",
              "example": "2021-07-02 07:46:01"
            },
            "method": {
              "type": "integer",
              "example": 6
            },
            "innerDescribe": {
              "type": "string"
            }
          }
        },
        "FeesTypesArray_inner": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 10
            },
            "name": {
              "type": "string",
              "example": "Пеня"
            },
            "sum": {
              "type": "integer",
              "example": 500
            },
            "defaultDescribe": {
              "type": "string"
            }
          }
        },
        "UserFeesArray_inner": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 10
            },
            "sum": {
              "type": "integer",
              "example": 500
            },
            "regDate": {
              "type": "string",
              "example": "2021-07-02 07:46:01"
            },
            "method": {
              "type": "integer",
              "example": 2
            },
            "dsc": {
              "type": "string",
              "example": "Internet: М/А Премиум до 100м (41) - Распределение абонплаты"
            }
          }
        },
        "AbonTpsArray_inner": {
          "type": "object",
          "properties": {
            "tpId": {
              "type": "integer",
              "example": 1
            },
            "name": {
              "type": "string",
              "example": "Test abon TP"
            },
            "price": {
              "type": "integer",
              "example": 100
            },
            "userPortal": {
              "type": "integer",
              "example": 0
            },
            "userCount": {
              "type": "integer",
              "example": 10
            },
            "discount": {
              "type": "integer",
              "example": 0
            },
            "paymentType": {
              "type": "integer",
              "example": 0
            },
            "periodAlignment": {
              "type": "integer",
              "example": 1
            },
            "nextAbonDate": {
              "type": "string",
              "example": "2021-10-01"
            },
            "description": {
              "type": "string"
            }
          }
        },
        "AbonUsersArray_inner": {
          "type": "object",
          "properties": {
            "tpId": {
              "type": "integer",
              "example": 1
            },
            "tpName": {
              "type": "string",
              "example": "Test abon TP"
            },
            "price": {
              "type": "integer",
              "example": 100
            },
            "serviceCount": {
              "type": "integer",
              "example": 1
            },
            "date": {
              "type": "string",
              "example": "2021-08-11"
            },
            "nextAbon": {
              "type": "string",
              "example": "2021-09-01"
            },
            "uid": {
              "type": "integer",
              "example": 11135
            },
            "login": {
              "type": "string",
              "example": "3433"
            }
          }
        },
        "OnlineSessionsArray_inner": {
          "type": "object",
          "properties": {
            "clientIpNum": {
              "type": "integer",
              "example": 3232238092
            },
            "nasId": {
              "type": "integer",
              "example": 12
            },
            "duration": {
              "type": "string",
              "example": "838:59:59"
            },
            "status": {
              "type": "integer",
              "example": 10
            },
            "userName": {
              "type": "string",
              "example": "userName"
            },
            "clientIp": {
              "type": "string",
              "example": "192.168.10.12"
            },
            "acctSessionId": {
              "type": "string",
              "example": "Akie6VpiYU"
            }
          }
        }
      }
    }
    AnchorAPI пользователяAPI пользователя Open API (Swagger) Integration for Confluence{ "swagger": "2.0", "info": { "version": "1.0.0", "title": "Abills user API" }, "host": "demo.abills.net.ua:9443", "basePath": "/api.cgi", "tags": [ { "name": "user", "description": "Работа с пользователем" }, { "name": "internet", "description": "Работа с услугой Интернет" }, { "name": "msgs", "description": "Работа с заявками пользователя" }, { "name": "abon", "description": "Работа с периодическими списаниями" } ], "schemes": [ "https" ], "paths": { "/user/{UID}": { "get": { "tags": [ "user" ], "summary": "Информация о пользователе", "operationId": "userInfo", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/User" } } }, "security": [ { "USER_SID": [] } ] } }, "/user/{UID}/pi": { "get": { "tags": [ "user" ], "summary": "Персональная информация пользователя", "operationId": "userPersonalInfo", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/UserPi" } } }, "security": [ { "USER_SID": [] } ] } }, "/user/{UID}/credit": { "get": { "tags": [ "user" ], "summary": "Информация об установке кредита", "operationId": "userCreditInfo", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/UserCreditInfo" } } }, "security": [ { "USER_SID": [] } ] }, "post": { "tags": [ "user" ], "summary": "Установка кредита пользователю", "operationId": "userSetCredit", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/UserCredit" } } }, "security": [ { "USER_SID": [] } ] } }, "/user/{UID}/internet": { "get": { "tags": [ "internet" ], "summary": "Информация об интернет услугах пользователя", "operationId": "userInternetInfo", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/UserInternet" } } }, "security": [ { "USER_SID": [] } ] } }, "/user/{UID}/internet/{ID}": { "put": { "tags": [ "internet" ], "summary": "Смена ТП", "operationId": "userChangeInternetTP", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" }, { "name": "ID", "in": "path", "description": "ID услуги Интернет", "required": true, "type": "string" }, { "in": "body", "name": "body", "required": true, "schema": { "$ref": "#/definitions/body" } } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/InternetChangeTPSuccess" } }, "400": { "description": "Ошибка", "schema": { "$ref": "#/definitions/InternetChangeTPError" } } }, "security": [ { "USER_SID": [] } ] } }, "/user/{UID}/internet/{ID}/speed": { "get": { "tags": [ "internet" ], "summary": "Скорость ТП", "operationId": "userTpSpeed", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" }, { "name": "ID", "in": "path", "description": "ID услуги Интернет", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/InternetSpeed" } } }, "security": [ { "USER_SID": [] } ] } }, "/user/{UID}/internet/{ID}/holdup": { "post": { "tags": [ "internet" ], "summary": "Приостановление услуги Интернет", "operationId": "userInternetHoldup", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" }, { "name": "ID", "in": "path", "description": "ID услуги Интернет", "required": true, "type": "string" }, { "in": "body", "name": "body", "required": true, "schema": { "$ref": "#/definitions/body_1" } } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/HoldupReply" } } }, "security": [ { "USER_SID": [] } ] }, "delete": { "tags": [ "internet" ], "summary": "Удаление рассписания на приостановление услуги Интернет", "operationId": "userDeleteInternetHoldup", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" }, { "name": "ID", "in": "path", "description": "ID услуги Интернет", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/HoldupReply" } } }, "security": [ { "USER_SID": [] } ] } }, "/user/{UID}/internet/tariffs": { "get": { "tags": [ "internet" ], "summary": "Доступные для изменения ТП", "operationId": "userInternetAvailableToChangeTariffs", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/UserAvailableTariffs" } } }, "security": [ { "USER_SID": [] } ] } }, "/user/{UID}/internet/tariffs/all": { "get": { "tags": [ "internet" ], "summary": "Доступные для изменения ТП", "operationId": "userInternetAvailableToChangeTariffs", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/UserAvailableTariffs" } } }, "security": [ { "USER_SID": [] } ] } }, "/user/{UID}/internet/{ID}/warnings": { "get": { "tags": [ "internet" ], "summary": "Информация о списаниях", "operationId": "userInternetWarnings", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" }, { "name": "ID", "in": "path", "description": "ID услуги", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/InternetWarnings" } } }, "security": [ { "USER_SID": [] } ] } }, "/user/{UID}/abon": { "get": { "tags": [ "abon" ], "summary": "Информация об периодических списаниях пользователя", "operationId": "userAbonInfo", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/UserAbon" } } }, "security": [ { "USER_SID": [] } ] } }, "/user/{UID}/msgs": { "get": { "tags": [ "msgs" ], "summary": "Список заявок пользователя", "operationId": "userMsgsList", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/MsgsArray" } } }, "security": [ { "USER_SID": [] } ] }, "post": { "tags": [ "msgs" ], "summary": "Создание заявки", "operationId": "userAddMessage", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" }, { "in": "body", "name": "body", "required": true, "schema": { "$ref": "#/definitions/MsgsAdd" } } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/MsgsAdded" } } }, "security": [ { "USER_SID": [] } ] } }, "/user/{UID}/msgs/{ID}": { "get": { "tags": [ "msgs" ], "summary": "Информация о заявке пользователя", "operationId": "userMsgs", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" }, { "name": "ID", "in": "path", "description": "ID заявки", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/MsgsInfo" } } }, "security": [ { "USER_SID": [] } ] } }, "/user/{UID}/msgs/{ID}/reply": { "get": { "tags": [ "msgs" ], "summary": "Список заявок пользователя", "operationId": "userMsgReplyList", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" }, { "name": "ID", "in": "path", "description": "ID заявки", "required": true, "type": "string" } ], "responses": { "200": { "description": "Успешное выполнение", "schema": { "$ref": "#/definitions/MsgsReplyArray" } } }, "security": [ { "USER_SID": [] } ] }, "post": { "tags": [ "msgs" ], "summary": "Создание заявки", "operationId": "userAddReply", "produces": [ "application/json" ], "parameters": [ { "name": "UID", "in": "path", "description": "UID пользователя", "required": true, "type": "string" }, { "name": "ID", "in": "path", "description": "ID заявки", "required": true, "type": "string" }, { "in": "body", "name": "body", "required": true, "schema": { "$ref": "#/definitions/MsgsReplyAdd" } } ], "responses": { "200": { "description": "Успешное выполнение" } }, "security": [ { "USER_SID": [] } ] } } }, "securityDefinitions": { "USER_SID": { "type": "apiKey", "name": "USERSID", "in": "header" } }, "definitions": { "User": { "properties": { "login": { "type": "string", "example": "3433" }, "deposit": { "type": "integer", "example": 1600 }, "credit": { "type": "integer", "example": 100 }, "creditDate": { "type": "string", "example": "2021-08-13" }, "billId": { "type": "integer", "example": 12 }, "gid": { "type": "integer", "example": 57 }, "disable": { "type": "integer", "example": 0 }, "deleted": { "type": "integer", "example": 0 } } }, "UserPi": { "properties": { "fio": { "type": "string", "example": "Иванов Иван Иванович" }, "addressFull": { "type": "string", "example": "ул.Адамца, 121, 3" }, "age": { "type": "integer", "example": 33 }, "locationId": { "type": "integer", "example": 1444 }, "contractId": { "type": "string", "example": "575493" }, "email": { "type": "array", "items": { "type": "string", "example": "test@gmail.com" } }, "phone": { "type": "array", "items": { "type": "string", "example": "380976574568" } } } }, "UserInternet": { "type": "array", "items": { "$ref": "#/definitions/UserInternet_inner" } }, "InternetSpeed": { "type": "array", "items": { "$ref": "#/definitions/InternetSpeed_inner" } }, "UserAbon": { "type": "array", "items": { "$ref": "#/definitions/UserAbon_inner" } }, "UserCredit": { "properties": { "creditSum": { "type": "integer", "example": 500 }, "creditChangePrice": { "type": "integer", "example": 100 }, "uid": { "type": "integer", "example": 11135 }, "creditDays": { "type": "string", "example": "3" }, "creditMonthChanges": { "type": "string", "example": "1" } } }, "UserCreditInfo": { "properties": { "creditChgPrice": { "type": "string", "example": "500" }, "creditMonthChanges": { "type": "string", "example": "1" }, "creditSum": { "type": "string", "example": "800" }, "creditDays": { "type": "string", "example": "3" } } }, "UserAvailableTariffs": { "type": "array", "items": { "$ref": "#/definitions/UserAvailableTariffs_inner" } }, "HoldupReply": { "properties": { "success": { "type": "integer", "example": 1 }, "msg": { "type": "string" } } }, "InternetWarnings": { "properties": { "messageType": { "type": "string", "example": "success" }, "warning": { "type": "string", "example": "следующее списание через 7 дней" }, "daysToFee": { "type": "string", "example": "2" }, "sum": { "type": "integer", "example": 150 }, "abonDate": { "type": "string", "example": "2021-10-01" } } }, "InternetChangeTPSuccess": { "properties": { "success": { "type": "integer", "example": 1 }, "uid": { "type": "integer" } } }, "InternetChangeTPError": { "properties": { "error": { "type": "integer", "example": 145 }, "message": { "type": "string" }, "messageType": { "type": "string" }, "messageTitle": { "type": "string" } } }, "MsgsAdd": { "properties": { "chapter": { "type": "integer", "example": 3 }, "message": { "type": "string", "example": "Some message" }, "subject": { "type": "string", "example": "Message subject" }, "priority": { "type": "integer", "example": 2 } } }, "MsgsAdded": { "properties": { "insertId": { "type": "integer", "example": 43 }, "msgId": { "type": "integer", "example": 43 }, "affected": { "type": "integer", "example": 1 } } }, "MsgsInfo": { "properties": { "subject": { "type": "string", "example": "Message user api subject" }, "message": { "type": "string", "example": "Test message from user api" }, "chapterName": { "type": "string", "example": "Второй раздел" }, "chapter": { "type": "integer", "example": 3 }, "priority": { "type": "integer", "example": 2 }, "state": { "type": "integer", "example": 0 }, "date": { "type": "string", "example": "2021-09-02 13:20:37" } } }, "MsgsArray": { "type": "array", "items": { "$ref": "#/definitions/MsgsInfo" } }, "MsgsReply": { "properties": { "uid": { "type": "integer", "example": 0 }, "aid": { "type": "integer", "example": 2 }, "id": { "type": "integer", "example": 54 }, "text": { "type": "string", "example": "some reply text" }, "datetime": { "type": "string", "example": "2021-09-02 12:50:47" } } }, "MsgsReplyAdd": { "properties": { "reply_text": { "type": "string", "example": "Some reply text" }, "reply_subject": { "type": "string", "example": "Subject" } } }, "MsgsReplyArray": { "type": "array", "items": { "$ref": "#/definitions/MsgsReply" } }, "body": { "properties": { "tp_id": { "type": "integer", "example": 4 }, "date": { "type": "string", "example": "2021-09-17" }, "period": { "type": "integer", "example": "2 (0 - моментальное изменение ТП, если разрешено, 1 - изменение ТП в след. учётный период, 2 - изменение ТП по указаной дате)" } } }, "body_1": { "properties": { "from_date": { "type": "string", "example": "2021-08-14" }, "to_date": { "type": "string", "example": "2021-08-17" } } }, "UserInternet_inner": { "type": "object", "properties": { "id": { "type": "integer", "example": 2 }, "tpName": { "type": "string", "example": "Премиум до 100м" }, "tpId": { "type": "integer", "example": 41 }, "internetStatus": { "type": "integer", "example": 0 }, "cid": { "type": "string", "example": "14:11:11:11:11:c1" }, "monthFee": { "type": "integer", "example": 250 }, "dayFee": { "type": "integer", "example": 0 } } }, "InternetSpeed_inner": { "type": "object", "properties": { "inSpeed": { "type": "integer", "example": 2999 }, "outSpeed": { "type": "integer", "example": 3000 }, "tpNum": { "type": "integer", "example": 155 } } }, "UserAbon_inner": { "type": "object", "properties": { "id": { "type": "integer", "example": 2 }, "name": { "type": "string", "example": "Test abon TP" }, "price": { "type": "integer", "example": 100 }, "period": { "type": "integer", "example": 1 }, "nextAbon": { "type": "string", "example": "2021-09-01" }, "comments": { "type": "string" }, "description": { "type": "string", "example": "Test description" } } }, "UserAvailableTariffs_inner": { "type": "object", "properties": { "id": { "type": "integer", "example": 2 }, "name": { "type": "string", "example": "Премиум до 100м" }, "tpId": { "type": "integer", "example": 41 }, "monthFee": { "type": "integer", "example": 250 }, "dayFee": { "type": "integer", "example": 0 }, "comments": { "type": "string" } } } } }

    Сделать ограничение на Admin RESTful API, можно с помощью опции $conf{API_IPS}, в конфигурационном файле config.pl, пример

    Code Block
    $conf{API_IPS} = '192.20.208.1, 217.116.76.0/24, 104.81.60.171';

    Или в настройках Настройка>Администраторы>Доступ


    Возвращать по почту письма, смс или другие вещи которые поддерживают перевод в RESTful API, можно включить с помощью опции $conf{API_CONF_LANGUAGE}, в конфигурационном файле config.pl, пример

    Code Block
    $conf{API_CONF_LANGUAGE} = 1;

    Опция дебага, позволяет выводить debuginfo при ошибке, и также её сохранять с API_LOG. Никак не влияет на работу системы.

    Code Block
    $conf{API_DEBUG} = 1;


    Авторизация

    Для подтверждения личности при выполнении запросов, некоторые пути требуют соответствующий привилегии:

    • Авторизация администратора выполняется через API_KEY. Ключ нужно передать в заголовке запроса KEY в значении API_KEY.
      Для получения API_KEY нужно его задать через веб-интерфейс
      Настройки > Администраторы, поле API_KEY.
    • Пользователям нужно использовать идентификатор сессии (sid), передавая его значение в заголовке USERSID
      Для получения sid можно воспользоваться авторизацией через API используя путь авторизация абонента (/user/login).


    Разрешить получить сессию администратора с помощью REST API

    Code Block
    $conf{API_ADMIN_AUTH_LOGIN} = 1;


    СТРОГО НЕ РЕКОМЕНДУЕТСЯ ДЛЯ ИСПОЛЬЗОВАНИЯ!!! Возвращает apiKey в запросе на получение сессии!!!

    Code Block
    $conf{API_ADMIN_AUTH_LOGIN_RETURN_API_KEY} = 1;


    Запуск на nginx

    Чтобы включить поддержку nginx нужно:


    Работа с API для ботов

    для авторизации в USER API телеграмм бота необходимо

    1) Прописать IP с которых будет обращаться бот к серверу

    Code Block
    $conf{BOT_APIS}='127.0.0.1';

    2) Прописать секрет бота для дополнительной проверки запроса (любое значение)

    Code Block
    $conf{BOT_SECRET}='test1234567787654';

    Авторизация происходит по хедеру X-ABillS-Bot-Secret

    X-ABillS-Bot-Secret хранится в телеграм боте и передается для авторизации

    Получение информации по пользователю и работа с пользователем

    1) хедер X-ABillS-Bot - какой именно бот авторизуется, возможные варианты - Viber, Telegram

    2) хедер X-ABillS-User-ID - id пользователя в боте

    3) хедер X-ABillS-Admin-ID - id админа в боте


    Получить OpenAPI вашей версии

    1) Прямо с API

    Выставьте переменную:

    Code Block
    $conf{API_SWAGGER} = 1;

    Обращайтесь за
    USER API     - /api.cgi/swagger
    ADMIN API - /api.cgi/swagger/admin

    Для того, чтобы развернуть Redocly, скопируйте файлы с misc/api/redocly/ в cgi-bin.
    USER API     - /redocly-user.html
    ADMIN API - /redocly-admin.html

    2) Прямо с файла

    В каждом биллинге уже установлен полностью скомпилированный OpenAPI.
    Они находятся за путями misc/api/bundle_user.yaml и misc/api/bundle_admin.yaml

    Стандарт REST

    Реализованный в системе RESTful интерфейс управления услугами и абонентами соответствует стандарту REST API.