{"openapi":"3.1.0","info":{"title":"дали дали: наблюдения жителей","version":"2.1.0","description":"Сообщения жителей. Отсутствие данных не означает наличие услуги. Проверяйте serverNow, expiresAt и nextExpiryAt."},"servers":[{"url":"https://xn--80aakbtcrd.xn--p1ai"}],"paths":{"/api/status":{"get":{"operationId":"getHouseServiceStatus","summary":"Состояние услуги по точному адресу","description":"Выполняйте новый запрос перед ответом о текущем состоянии. Данные основаны на наблюдениях жителей за последний час. Отсутствие свежих сообщений не означает, что услуга есть или отсутствует.","parameters":[{"name":"city","in":"query","required":true,"description":"Название или идентификатор населённого пункта","schema":{"type":"string","maxLength":180},"example":"donetsk"},{"name":"street","in":"query","required":true,"description":"Точное название или идентификатор улицы","schema":{"type":"string","maxLength":180},"example":"Петровского"},{"name":"house","in":"query","required":true,"description":"Точный номер или идентификатор дома","schema":{"type":"string","maxLength":180},"example":"100"},{"name":"resource","in":"query","required":true,"schema":{"type":"string","enum":["electricity","water","heating","internet","cable"]},"example":"electricity"}],"responses":{"200":{"description":"Наблюдения по адресу или отсутствие свежих наблюдений","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HouseServiceStatus"}}}},"400":{"description":"Не хватает параметров или указана неизвестная услуга"},"404":{"description":"Адрес не найден в действующем справочнике"},"409":{"description":"Есть несколько подходящих адресов. Используйте идентификаторы"},"503":{"description":"Справочник или свежие данные временно недоступны"}}}},"/api/cities":{"get":{"summary":"Поддерживаемые города","responses":{"200":{"description":"Идентификаторы и названия городов"}},"operationId":"listSettlements"}},"/api/reports":{"get":{"summary":"Актуальные сообщения по городу и услуге","parameters":[{"name":"city","in":"query","required":true,"schema":{"type":"string"},"example":"donetsk"},{"name":"resource","in":"query","required":true,"schema":{"type":"string","enum":["electricity","water","heating","internet","cable"]}},{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":120},"description":"Поиск по улице и номеру дома"},{"name":"X-Pereklichka-Mode","in":"header","required":false,"schema":{"type":"string","enum":["live","demo"]},"description":"Обычный публичный сервер работает в live. Если заголовок передан, он должен быть live. Прежний клиент с другим режимом получает 409 MODE_CHANGED."},{"name":"district","in":"query","required":false,"description":"Район в сводке summary. На список сообщений и поиск не влияет.","schema":{"type":"string","maxLength":180}},{"name":"neighborhood","in":"query","required":false,"description":"Микрорайон в сводке summary. На список сообщений и поиск не влияет.","schema":{"type":"string","maxLength":180}},{"name":"page","in":"query","description":"Страница адресов. При наличии параметра ответ содержит до 20 домов.","schema":{"type":"integer","minimum":1}},{"name":"status","in":"query","description":"Фильтр домов по состоянию. На summary не влияет.","schema":{"type":"string","enum":["on","off"]}}],"responses":{"200":{"description":"Свежая выборка. groups учитывает все актуальные ответы; reports может быть ограничен.","content":{"application/json":{"schema":{"type":"object","required":["serverNow","reports","groups","demoMode"],"properties":{"serverNow":{"type":"integer","description":"Время сервера, Unix milliseconds"},"reports":{"type":"array","items":{"$ref":"#/components/schemas/Report"}},"groups":{"type":"array","items":{"type":"object","properties":{"houseId":{"type":"string"},"status":{"enum":["on","off","mixed"]},"onCount":{"type":"integer"},"offCount":{"type":"integer"},"nextExpiryAt":{"type":"integer","description":"После этого времени агрегат требует обновления"},"weakCount":{"type":"integer","minimum":0,"description":"Число текущих water/on наблюдений с pressure weak или trickle. Входит в onCount; не меняет mixed."}}}},"limited":{"type":"boolean"},"groupsLimited":{"type":"boolean"},"total":{"type":"integer"},"totalHouses":{"type":"integer"},"demoMode":{"type":"boolean","description":"true означает демонстрационные данные, а не реальные наблюдения жителей"},"summary":{"type":"object","description":"По всем домам со свежими сообщениями в заданной территории. Разные ответы одного дома учитываются в mixed один раз.","properties":{"on":{"type":"integer","minimum":0},"off":{"type":"integer","minimum":0},"mixed":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"validUntil":{"type":["integer","null"]}}},"page":{"type":"integer","minimum":1},"pages":{"type":"integer","minimum":1}}}}}},"429":{"description":"Лимит запросов; повторить после Retry-After"},"503":{"description":"Сервис недоступен; не выдавать старые данные за текущие"},"400":{"description":"Неверные параметры. Ресурсы: electricity, water, heating, internet, cable."},"409":{"description":"MODE_CHANGED: прежний клиент использует другой режим. Откройте актуальную версию сайта."},"304":{"description":"Данные для запроса If-None-Match не изменились."}},"operationId":"getLiveReports"}},"/api/catalog":{"get":{"summary":"Готовые улицы города или дома выбранной улицы","parameters":[{"name":"city","in":"query","required":true,"schema":{"type":"string"}},{"name":"street","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Каталог ГАР с версией источника version. Необязательные уточнения привязки домов и территорий версионируются отдельно в territoryVersion."}},"operationId":"getAddressCatalog"}},"/api/history":{"get":{"summary":"История наблюдений по дому, без оценки часов отключения","description":"Максимум 200 записей. Срок хранения 30 дней. counts считает все выбранные наблюдения. Пропуски не означают наличия или отсутствия услуги. Личность, этаж и технический идентификатор жителя отсутствуют.","parameters":[{"name":"house","in":"query","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"resource","in":"query","required":true,"schema":{"type":"string","enum":["electricity","water","heating","internet","cable"]}},{"name":"days","in":"query","schema":{"type":"integer","enum":[1,7,30],"default":7}}],"responses":{"200":{"description":"История сообщений, newest first","content":{"application/json":{"schema":{"type":"object","properties":{"houseId":{"type":"string","format":"uuid"},"resource":{"enum":["electricity","water","heating","internet","cable"]},"days":{"enum":[1,7,30]},"observations":{"type":"array","maxItems":200,"items":{"$ref":"#/components/schemas/Observation"}},"serverNow":{"type":"integer"},"total":{"type":"integer"},"limited":{"type":"boolean"},"counts":{"type":"object","properties":{"on":{"type":"integer","minimum":0},"off":{"type":"integer","minimum":0},"weak":{"type":"integer","minimum":0}}}}}}}},"400":{"description":"Некорректный дом, ресурс или период"},"429":{"description":"Повторить после Retry-After"}},"operationId":"getHouseHistory"}},"/api/telegram/link":{"post":{"summary":"Подготовить ссылку на добровольную подписку в Telegram","description":"Требует существующего авторского cookie, корректного Origin и Content-Type application/json. Ссылка действует 15 минут; подписка появляется только после запуска бота. Область проверяется по ГАР. scopeLabel из запроса не принимается.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["cityId","resource","scope","scopeValue"],"properties":{"cityId":{"type":"string"},"resource":{"enum":["all","electricity","water","heating","internet","cable"]},"scope":{"enum":["city","district","neighborhood","street","house"]},"scopeValue":{"type":"string","maxLength":180,"description":"Для city пустая строка; для district/neighborhood точное значение каталога; для street/house GUID."},"streetId":{"type":"string","format":"uuid","description":"Требуется только для scope=house, чтобы проверить связь дома с улицей."}}}}}},"responses":{"200":{"description":"Ссылка на t.me и срок её действия","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"expiresAt":{"type":"integer"},"serverNow":{"type":"integer"}}}}}},"400":{"description":"Неизвестная или неподтверждённая область"},"403":{"description":"Некорректный Origin"},"428":{"description":"Сначала установите авторскую сессию через /api/mine"},"429":{"description":"Превышен лимит запросов или активных ссылок"},"503":{"description":"Telegram не подключён либо сервис временно недоступен"}}}}},"components":{"schemas":{"Report":{"type":"object","required":["id","houseId","resource","status","confirmedAt","expiresAt"],"properties":{"id":{"type":"string"},"houseId":{"type":"string"},"street":{"type":"string"},"house":{"type":"string"},"resource":{"enum":["electricity","water","heating","internet","cable"]},"status":{"enum":["on","off"]},"confirmedAt":{"type":"integer"},"expiresAt":{"type":"integer"},"eventAt":{"type":["integer","null"]},"floor":{"type":["integer","null"]},"pressure":{"type":["string","null"],"enum":["normal","weak","trickle","strong",null]},"voltage":{"type":["integer","null"],"minimum":1,"maximum":500,"description":"Необязательное индивидуальное напряжение в вольтах. Допустимо только для electricity/on. null означает, что значение не указано; это не напряжение для всего дома. Диапазон ограничивает ввод и не определяет безопасное напряжение."},"privateHouse":{"type":"boolean","description":"Только для water."}},"allOf":[{"if":{"properties":{"resource":{"const":"electricity"},"status":{"const":"on"}},"required":["resource","status"]},"else":{"properties":{"voltage":{"type":"null"}}}}]},"Observation":{"type":"object","required":["status","pressure","voltage","eventAt","confirmedAt","expiresAt"],"additionalProperties":false,"properties":{"status":{"enum":["on","off"]},"pressure":{"type":["string","null"],"enum":["normal","weak","trickle","strong",null]},"voltage":{"type":["integer","null"],"minimum":1,"maximum":500,"description":"Необязательное индивидуальное напряжение в вольтах. Допустимо только для electricity/on. null означает, что значение не указано; это не напряжение для всего дома. Диапазон ограничивает ввод и не определяет безопасное напряжение."},"eventAt":{"type":["integer","null"]},"confirmedAt":{"type":"integer"},"expiresAt":{"type":"integer"}}},"HouseServiceStatus":{"type":"object","required":["address","resource","status","onCount","offCount","latestConfirmedAt","nextExpiryAt","serverNow","validityMinutes","dataSource","sourceUrl"],"properties":{"address":{"type":"object","required":["cityId","city","streetId","street","houseId","house"],"properties":{"cityId":{"type":"string"},"city":{"type":"string"},"streetId":{"type":"string"},"street":{"type":"string"},"houseId":{"type":"string"},"house":{"type":"string"}}},"resource":{"type":"string","enum":["electricity","water","heating","internet","cable"]},"status":{"type":"string","enum":["on","off","mixed","no_data"],"description":"on и off относятся к сообщениям жителей. mixed означает расхождение, no_data означает отсутствие свежих ответов."},"onCount":{"type":"integer","minimum":0},"offCount":{"type":"integer","minimum":0},"latestConfirmedAt":{"type":["integer","null"],"description":"Момент последнего подтверждения, Unix в миллисекундах."},"nextExpiryAt":{"type":["integer","null"],"description":"Первая отметка истекает в этот момент, Unix в миллисекундах. К этому времени сводку нужно обновить."},"serverNow":{"type":"integer","description":"Момент расчёта, Unix в миллисекундах."},"validityMinutes":{"type":"integer","const":60},"dataSource":{"type":"string","const":"resident_reports"},"sourceUrl":{"type":"string","format":"uri","description":"Прямая HTML-ссылка на состояние этого дома."}}}}}}
