diff --git a/docs/api/dns/cacheinfo.md b/docs/api/dns/cacheinfo.md index 888bfd8..e5cba78 100644 --- a/docs/api/dns/cacheinfo.md +++ b/docs/api/dns/cacheinfo.md @@ -18,8 +18,8 @@ None === "cURL" ``` bash - curl -H "Authorization: Token " \ - http://pi.hole:8080/admin/api/dns/cacheinfo + curl http://pi.hole:8080/admin/api/dns/cacheinfo \ + -H "Authorization: Token " ``` === "Python 3" diff --git a/docs/api/dns/status.md b/docs/api/dns/status.md index 15de7f2..1085b42 100644 --- a/docs/api/dns/status.md +++ b/docs/api/dns/status.md @@ -2,7 +2,7 @@ ## GET: Obtain current blocking status -Resource: `GET /admin/api/dns/status` +Resource: `GET /admin/api/dns/blocking` Requires authorization: No @@ -18,7 +18,7 @@ None === "cURL" ``` bash - curl http://pi.hole:8080/admin/api/dns/status + curl http://pi.hole:8080/admin/api/dns/blocking ``` === "Python 3" @@ -26,7 +26,7 @@ None ``` python import requests - URL = 'http://pi.hole:8080/admin/api/dns/status' + URL = 'http://pi.hole:8080/admin/api/dns/blocking' response = requests.get(URL) @@ -39,14 +39,14 @@ None ``` json { - "status": "enabled" + "status": "active" } ``` ## `POST`: Set/change blocking status -Resource: `POST /admin/api/dns/status` +Resource: `POST /admin/api/dns/blocking` Requires authorization: Yes @@ -54,8 +54,8 @@ Requires authorization: Yes Name | Required | Type | Description | Default | Example ---- | -------- | ---- | ----------- | ------- | ------- -`action` | Yes | String | Requested status | | `enable` or `disable` -`time` | Optional | Number | Requested delay until opposite status is enabled | `0` | `100` (seconds) +`status` | Yes | String | Requested status | | `active` or `inactive` +`delay` | Optional | Number | Requested delay until opposite status is active | `0` | `100` (seconds) ### Example @@ -65,19 +65,19 @@ Name | Required | Type | Description | Default | Example === "cURL" ``` bash - curl -X POST \ - -H "Authorization: Token " \ - http://pi.hole:8080/admin/api/dns/status \ - -H "Content-Type: application/json" \ - -d @body.json + curl http://pi.hole:8080/admin/api/dns/blocking \ + -X POST \ + -H "Authorization: Token " \ + -H "Content-Type: application/json" \ + -d @body.json ``` The content of `body.json` is like, ``` json { - "action": "enable", - "time": 30 + "status": "active", + "delay": 30 } ``` @@ -86,7 +86,7 @@ Name | Required | Type | Description | Default | Example ``` python import requests - URL = 'http://pi.hole:8080/admin/api/dns/status' + URL = 'http://pi.hole:8080/admin/api/dns/blocking' TOKEN = '' HEADERS = {'Authorization': f'Token {TOKEN}'} data = json.load(open('body.json', 'rb')) @@ -104,8 +104,8 @@ Name | Required | Type | Description | Default | Example ``` json { - "action": "enable", - "time": 30 + "status": "active", + "delay": 30 } ``` @@ -115,7 +115,7 @@ Name | Required | Type | Description | Default | Example ``` json { - "key": "enabled" + "status": "active" } ``` diff --git a/docs/api/domainlists.md b/docs/api/domainlists.md index 39d6b0d..3979d3b 100644 --- a/docs/api/domainlists.md +++ b/docs/api/domainlists.md @@ -102,9 +102,9 @@ Name | Required | Type | Description | Default | Example === "cURL" ``` bash - curl -X PUT \ + curl http://pi.hole:8080/admin/api/whitelist/exact \ + -X PUT \ -H "Authorization: Token " \ - http://pi.hole:8080/admin/api/whitelist/exact \ -H "Content-Type: application/json" \ -d @body.json ``` @@ -196,18 +196,18 @@ The domain/regex to be removed is specified through the URL (``). **Domain** ``` bash - curl -X DELETE \ - -H "Authorization: Token " \ - http://pi.hole:8080/admin/api/whitelist/exact/whitelisted.com + curl http://pi.hole:8080/admin/api/whitelist/exact/whitelisted.com \ + -X DELETE \ + -H "Authorization: Token " ``` **Regular expression** ``` bash - regex="$(echo "(^|\\.)facebook.com$" | jq -sRr '@uri')" - curl -X DELETE \ - -H "Authorization: Token " \ - http://pi.hole:8080/admin/api/whitelist/exact/${regex} + regex="$(echo -n "(^|\\.)facebook.com$" | jq -sRr '@uri')" + curl http://pi.hole:8080/admin/api/whitelist/exact/${regex} \ + -X DELETE \ + -H "Authorization: Token " ``` === "Python" diff --git a/docs/api/index.md b/docs/api/index.md index e5325d3..97008d8 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -18,8 +18,8 @@ The Authorization HTTP header can be specified with `Token ` === "cURL" ``` bash - curl -H "Authorization: Token " \ - http://pi.hole/admin/api/dns/status + curl http://pi.hole/admin/api/dns/status \ + -H "Authorization: Token " ``` === "Python 3" diff --git a/mkdocs.yml b/mkdocs.yml index 642f077..566eaff 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -121,8 +121,8 @@ nav: - 'Overview': api/index.md - 'DNS': - 'Status': api/dns/status.md - - 'Domain Lists': api/dns/lists.md - 'Cache Info': api/dns/cacheinfo.md + - 'Domain Lists': api/domainlists.md - 'FTL': - 'Network': api/tbd.md - 'Logs': api/tbd.md