diff --git a/docs/api/dns/status.md b/docs/api/dns/status.md index 1085b42..4fbc543 100644 --- a/docs/api/dns/status.md +++ b/docs/api/dns/status.md @@ -69,16 +69,7 @@ Name | Required | Type | Description | Default | Example -X POST \ -H "Authorization: Token " \ -H "Content-Type: application/json" \ - -d @body.json - ``` - - The content of `body.json` is like, - - ``` json - { - "status": "active", - "delay": 30 - } + -d '{"status":"active", "delay":30}' ``` === "Python 3" @@ -89,26 +80,13 @@ Name | Required | Type | Description | Default | Example URL = 'http://pi.hole:8080/admin/api/dns/blocking' TOKEN = '' HEADERS = {'Authorization': f'Token {TOKEN}'} - data = json.load(open('body.json', 'rb')) + data = {"status":"active", "delay":30} - response = requests.post( - URL, - json=data, - headers=HEADERS, - ) + response = requests.post(URL, json=data, headers=HEADERS) print(response.json()) ``` - The content of `body.json` is like, - - ``` json - { - "status": "active", - "delay": 30 - } - ``` - !!! success "Response" Response code: `HTTP/1.1 200 OK` diff --git a/docs/api/domainlists.md b/docs/api/domainlists.md index 3979d3b..f4550fa 100644 --- a/docs/api/domainlists.md +++ b/docs/api/domainlists.md @@ -106,7 +106,7 @@ Name | Required | Type | Description | Default | Example -X PUT \ -H "Authorization: Token " \ -H "Content-Type: application/json" \ - -d @body.json + -d '{"domain":"whitelisted.com", "enabled":true, "comment":"Some text"}' ``` === "Python 3" @@ -117,27 +117,13 @@ Name | Required | Type | Description | Default | Example URL = 'http://pi.hole:8080/admin/api/whitelist/exact' TOKEN = '' HEADERS = {'Authorization': f'Token {TOKEN}'} - data = json.load(open('body.json', 'rb')) + data = {"domain":"whitelisted.com", "enabled":True, "comment":"Some text"} - response = requests.put( - URL, - json=data, - headers=HEADERS, - ) + response = requests.put(URL, json=data, headers=HEADERS) print(response.json()) ``` - The content of `body.json` is - - ``` json - { - "domain": "whitelisted.com", - "enabled": true, - "comment": "Some text" - } - ``` - !!! success "Success response" Response code: `HTTP/1.1 201 Created`