Skip to content

Commit a94594a

Browse files
committed
Update documentation
Signed-off-by: DL6ER <[email protected]>
1 parent 2bbeea0 commit a94594a

File tree

5 files changed

+320
-163
lines changed

5 files changed

+320
-163
lines changed

docs/api/dns/blocking.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@
1010
=== "cURL"
1111

1212
``` bash
13-
curl -X GET http://pi.hole:8080/api/dns/blocking
13+
curl -X GET http://pi.hole/api/dns/blocking
1414
```
1515

1616
=== "Python 3"
1717

1818
``` python
1919
import requests
2020

21-
URL = 'http://pi.hole:8080/api/dns/blocking'
22-
23-
response = requests.get(URL)
21+
url = 'http://pi.hole/api/dns/blocking'
22+
response = requests.get(url)
2423

2524
print(response.json())
2625
```
@@ -29,7 +28,7 @@
2928

3029
None
3130

32-
??? success "Response"
31+
???+ success "Response"
3332

3433
Response code: `HTTP/1.1 200 OK`
3534

@@ -77,28 +76,26 @@
7776
- `POST /api/dns/blocking`
7877

7978
<!-- markdownlint-disable code-block-style -->
80-
???+ example "Request (requires authorization)"
79+
???+ example "🔒 Request"
8180

8281
=== "cURL"
8382

8483
``` bash
85-
curl -X POST http://pi.hole:8080/api/dns/blocking \
86-
-H "Authorization: Token <your-access-token>" \
84+
curl -X PUT http://pi.hole/api/dns/blocking \
8785
-H "Content-Type: application/json" \
88-
-d '{"blocking": false, "delay": 30}'
86+
-d "{\"blocking\": false, \"delay\": 30, \"sid\": \"${sid}\"}"
8987
```
9088

9189
=== "Python 3"
9290

9391
``` python
9492
import requests
9593

96-
URL = 'http://pi.hole:8080/api/dns/blocking'
97-
TOKEN = '<your-access-token>'
98-
HEADERS = {'Authorization': f'Token {TOKEN}'}
99-
data = {"blocking": False, "delay": 30}
94+
sid = '<valid session id>'
95+
url = 'http://pi.hole/api/dns/blocking'
96+
data = {"blocking": False, "delay": 30, "sid": sid}
10097

101-
response = requests.post(URL, json=data, headers=HEADERS)
98+
response = requests.put(url, json=data)
10299

103100
print(response.json())
104101
```
@@ -115,7 +112,7 @@
115112

116113
This setting has no effect when requesting the same blocking state that is already active.
117114

118-
??? success "Response"
115+
???+ success "Response"
119116

120117
Response code: `HTTP/1.1 200 OK`
121118

docs/api/dns/cache.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@
55
- `GET /api/dns/cache`
66

77
<!-- markdownlint-disable code-block-style -->
8-
???+ example "Request (requires authorization)"
8+
???+ example "🔒 Request"
99

1010
=== "cURL"
1111

1212
``` bash
13-
curl -X GET http://pi.hole:8080/api/dns/cacheinfo \
14-
-H "Authorization: Token <your-access-token>"
13+
curl -X GET http://pi.hole/api/dns/cacheinfo \
14+
-d sid="$sid"
1515
```
1616

1717
=== "Python 3"
1818

1919
``` python
2020
import requests
2121

22-
URL = 'http://pi.hole:8080/api/dns/cacheinfo'
23-
TOKEN = '<your-access-token>'
24-
HEADERS = {'Authorization': f'Token {TOKEN}'}
22+
url = 'http://pi.hole/api/dns/cacheinfo'
23+
sid = '<valid session id>'
24+
data = {"sid": sid}
2525

26-
response = requests.get(URL, headers=HEADERS)
26+
response = requests.get(url, json=data)
2727

2828
print(response.json())
2929
```

0 commit comments

Comments
 (0)