Finished reworking openapi, added DHCP methods there
This commit is contained in:
parent
b91c829f4c
commit
fcf7b2185e
|
@ -11,6 +11,9 @@ tags:
|
||||||
-
|
-
|
||||||
name: global
|
name: global
|
||||||
description: 'AdGuard Home server general settings and controls'
|
description: 'AdGuard Home server general settings and controls'
|
||||||
|
-
|
||||||
|
name: log
|
||||||
|
description: 'AdGuard Home query log'
|
||||||
-
|
-
|
||||||
name: stats
|
name: stats
|
||||||
description: 'AdGuard Home statistics'
|
description: 'AdGuard Home statistics'
|
||||||
|
@ -33,6 +36,16 @@ tags:
|
||||||
name: dhcp
|
name: dhcp
|
||||||
description: 'Built-in DHCP server controls'
|
description: 'Built-in DHCP server controls'
|
||||||
paths:
|
paths:
|
||||||
|
|
||||||
|
# API TO-DO LIST
|
||||||
|
# TODO: Use JSON where it is possible
|
||||||
|
# TODO: Use lower_case for all objects' properties
|
||||||
|
# TODO: Move to definitions what's missing from there
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# General settings and controls
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
/status:
|
/status:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -46,6 +59,7 @@ paths:
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/ServerStatus"
|
$ref: "#/definitions/ServerStatus"
|
||||||
|
|
||||||
/enable_protection:
|
/enable_protection:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -55,6 +69,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/disable_protection:
|
/disable_protection:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -64,6 +79,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/set_upstream_dns:
|
/set_upstream_dns:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -87,6 +103,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/test_upstream_dns:
|
/test_upstream_dns:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -118,10 +135,14 @@ paths:
|
||||||
8.8.4.4: OK
|
8.8.4.4: OK
|
||||||
"192.168.1.104:53535": "Couldn't communicate with DNS server"
|
"192.168.1.104:53535": "Couldn't communicate with DNS server"
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# Query log methods
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
/querylog:
|
/querylog:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- stats
|
- log
|
||||||
operationId: queryLog
|
operationId: queryLog
|
||||||
summary: 'Get DNS server query log'
|
summary: 'Get DNS server query log'
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -137,7 +158,7 @@ paths:
|
||||||
/querylog_enable:
|
/querylog_enable:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- stats
|
- log
|
||||||
operationId: querylogEnable
|
operationId: querylogEnable
|
||||||
summary: 'Enable querylog'
|
summary: 'Enable querylog'
|
||||||
responses:
|
responses:
|
||||||
|
@ -146,13 +167,17 @@ paths:
|
||||||
/querylog_disable:
|
/querylog_disable:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- stats
|
- log
|
||||||
operationId: querylogDisable
|
operationId: querylogDisable
|
||||||
summary: 'Disable filtering'
|
summary: 'Disable filtering'
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# General statistics methods
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
/stats_top:
|
/stats_top:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -164,6 +189,7 @@ paths:
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/StatsTop"
|
$ref: "#/definitions/StatsTop"
|
||||||
|
|
||||||
/stats:
|
/stats:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -175,6 +201,7 @@ paths:
|
||||||
description: 'Returns general statistics for the last 24 hours'
|
description: 'Returns general statistics for the last 24 hours'
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/Stats"
|
$ref: "#/definitions/Stats"
|
||||||
|
|
||||||
/stats_history:
|
/stats_history:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -210,6 +237,7 @@ paths:
|
||||||
description: 'Returns historical stats for the specified time interval.'
|
description: 'Returns historical stats for the specified time interval.'
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/StatsHistory'
|
$ref: '#/definitions/StatsHistory'
|
||||||
|
|
||||||
/stats_reset:
|
/stats_reset:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -220,6 +248,10 @@ paths:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# DHCP server methods
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
/dhcp/status:
|
/dhcp/status:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -231,6 +263,7 @@ paths:
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/DhcpStatus"
|
$ref: "#/definitions/DhcpStatus"
|
||||||
|
|
||||||
/dhcp/set_config:
|
/dhcp/set_config:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -249,19 +282,34 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
/dhcp/check_active_dhcp:
|
|
||||||
post:
|
/dhcp/find_active_dhcp:
|
||||||
|
get:
|
||||||
tags:
|
tags:
|
||||||
- dhcp
|
- dhcp
|
||||||
operationId: checkActiveDhcp
|
operationId: checkActiveDhcp
|
||||||
summary: "Checks if there's an active DHCP server on the network"
|
summary: "Searches for an active DHCP server on the network"
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
examples:
|
schema:
|
||||||
application/json:
|
$ref: "#/definitions/DhcpSearchResult"
|
||||||
found: true
|
|
||||||
gatewayIp: 192.168.1.1
|
# --------------------------------------------------
|
||||||
|
# Filtering status methods
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
|
/filtering/status:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- filtering
|
||||||
|
operationId: filteringStatus
|
||||||
|
summary: 'Get status of rules-based filter'
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/FilteringStatus"
|
||||||
|
|
||||||
/filtering/enable:
|
/filtering/enable:
|
||||||
post:
|
post:
|
||||||
|
@ -272,6 +320,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/filtering/disable:
|
/filtering/disable:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -281,6 +330,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/filtering/add_url:
|
/filtering/add_url:
|
||||||
put:
|
put:
|
||||||
tags:
|
tags:
|
||||||
|
@ -300,6 +350,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/filtering/remove_url:
|
/filtering/remove_url:
|
||||||
delete:
|
delete:
|
||||||
tags:
|
tags:
|
||||||
|
@ -319,6 +370,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/filtering/enable_url:
|
/filtering/enable_url:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -338,6 +390,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/filtering/disable_url:
|
/filtering/disable_url:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -357,6 +410,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/filtering/refresh:
|
/filtering/refresh:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -382,28 +436,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK with how many filters were actually updated
|
description: OK with how many filters were actually updated
|
||||||
/filtering/status:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- filtering
|
|
||||||
operationId: filteringStatus
|
|
||||||
summary: 'Get status of rules-based filter'
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: OK
|
|
||||||
examples:
|
|
||||||
# TODO: move to definitions
|
|
||||||
application/json:
|
|
||||||
enabled: false
|
|
||||||
filters:
|
|
||||||
enabled: true
|
|
||||||
id: 1
|
|
||||||
lastUpdated: "2018-10-30T12:18:57.223101822+03:00"
|
|
||||||
name: "AdGuard Simplified Domain Names filter"
|
|
||||||
rulesCount: 24896
|
|
||||||
url: "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt"
|
|
||||||
rules:
|
|
||||||
- '@@||yandex.ru^|'
|
|
||||||
/filtering/set_rules:
|
/filtering/set_rules:
|
||||||
put:
|
put:
|
||||||
tags:
|
tags:
|
||||||
|
@ -424,6 +457,10 @@ paths:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# Safebrowsing methods
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
/safebrowsing/enable:
|
/safebrowsing/enable:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -433,6 +470,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/safebrowsing/disable:
|
/safebrowsing/disable:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -442,6 +480,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/safebrowsing/status:
|
/safebrowsing/status:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -455,6 +494,10 @@ paths:
|
||||||
application/json:
|
application/json:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# Parental control methods
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
/parental/enable:
|
/parental/enable:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -485,6 +528,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/parental/disable:
|
/parental/disable:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -494,6 +538,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/parental/status:
|
/parental/status:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -508,6 +553,10 @@ paths:
|
||||||
enabled: true
|
enabled: true
|
||||||
sensitivity: 13
|
sensitivity: 13
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# Safe search methods
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
/safesearch/enable:
|
/safesearch/enable:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -517,6 +566,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/safesearch/disable:
|
/safesearch/disable:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -526,6 +576,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/safesearch/status:
|
/safesearch/status:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -539,6 +590,10 @@ paths:
|
||||||
application/json:
|
application/json:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# I18N methods
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
/i18n/change_language:
|
/i18n/change_language:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -558,6 +613,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
|
|
||||||
/i18n/current_language:
|
/i18n/current_language:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -572,8 +628,6 @@ paths:
|
||||||
en
|
en
|
||||||
|
|
||||||
definitions:
|
definitions:
|
||||||
rule:
|
|
||||||
type: string
|
|
||||||
ServerStatus:
|
ServerStatus:
|
||||||
type: "object"
|
type: "object"
|
||||||
description: "AdGuard Home server status and configuration"
|
description: "AdGuard Home server status and configuration"
|
||||||
|
@ -619,6 +673,56 @@ definitions:
|
||||||
language:
|
language:
|
||||||
type: "string"
|
type: "string"
|
||||||
example: "en"
|
example: "en"
|
||||||
|
Filter:
|
||||||
|
type: "object"
|
||||||
|
description: "Filter subscription info"
|
||||||
|
required:
|
||||||
|
- "enabled"
|
||||||
|
- "id"
|
||||||
|
- "lastUpdated"
|
||||||
|
- "name"
|
||||||
|
- "rulesCount"
|
||||||
|
- "url"
|
||||||
|
properties:
|
||||||
|
enabled:
|
||||||
|
type: "boolean"
|
||||||
|
id:
|
||||||
|
type: "integer"
|
||||||
|
example: 1234
|
||||||
|
lastUpdated:
|
||||||
|
type: "string"
|
||||||
|
format: "date-time"
|
||||||
|
example: "2018-10-30T12:18:57.223101822+03:00"
|
||||||
|
name:
|
||||||
|
type: "string"
|
||||||
|
example: "AdGuard Simplified Domain Names filter"
|
||||||
|
rulesCount:
|
||||||
|
type: "integer"
|
||||||
|
example: 5912
|
||||||
|
url:
|
||||||
|
type: "string"
|
||||||
|
example: "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt"
|
||||||
|
FilteringStatus:
|
||||||
|
type: "object"
|
||||||
|
description: "Filtering settings"
|
||||||
|
required:
|
||||||
|
- "enabled"
|
||||||
|
- "filters"
|
||||||
|
- "user_rules"
|
||||||
|
properties:
|
||||||
|
enabled:
|
||||||
|
type: "boolean"
|
||||||
|
filters:
|
||||||
|
type: "array"
|
||||||
|
items:
|
||||||
|
$ref: "#/definitions/Filter"
|
||||||
|
user_rules:
|
||||||
|
type: "array"
|
||||||
|
items:
|
||||||
|
type: "string"
|
||||||
|
example:
|
||||||
|
- '||example.org^'
|
||||||
|
- '||example.com^'
|
||||||
Stats:
|
Stats:
|
||||||
type: "object"
|
type: "object"
|
||||||
description: "General server stats for the last 24 hours"
|
description: "General server stats for the last 24 hours"
|
||||||
|
@ -818,6 +922,17 @@ definitions:
|
||||||
type: "array"
|
type: "array"
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/DhcpLease"
|
$ref: "#/definitions/DhcpLease"
|
||||||
|
DhcpSearchResult:
|
||||||
|
type: "object"
|
||||||
|
description: "Information about a DHCP server discovered in the current network"
|
||||||
|
required:
|
||||||
|
- "found"
|
||||||
|
properties:
|
||||||
|
found:
|
||||||
|
type: "boolean"
|
||||||
|
gateway_ip:
|
||||||
|
type: "string"
|
||||||
|
example: "192.168.1.1"
|
||||||
DnsAnswer:
|
DnsAnswer:
|
||||||
type: "object"
|
type: "object"
|
||||||
description: "DNS answer section"
|
description: "DNS answer section"
|
||||||
|
|
Loading…
Reference in New Issue