# PiHole V6 disable blocking

**URL:** <https://discourse.nodered.org/t/pihole-v6-disable-blocking/96074>\
**Category:** Share Your Projects\
**Created:** [17 March 2025 19:55 UTC](https://discourse.nodered.org/t/pihole-v6-disable-blocking/96074 "2025-03-17T19:55:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [17 March 2025 19:55 UTC](https://discourse.nodered.org/t/pihole-v6-disable-blocking/96074/1 "2025-03-17T19:55:33Z")

</div>

In PiHole V6 the api is changed to a REST api so the examples that can be found on the forum to use the api from V5 are not working anymore with NR.

I made a small example how to use the new api from within NR. For me sometimes you need to disable the PiHole blocking because you want to see some advertisements. That's what this example is about. You can disable blocking for an x amount of time.  
With the second half of the example you can read back the blocking status.

Don't forget to change the password in the 2 inject nodes.  
In Pihole V6 you can find or create the password under _Settings, Webinterface /api_. Then press the green _basic_ button in the top right corner to switch to _expert_.  
Press _configure app password_ to create a password.

With this example it should not be difficult to use other api functions that require authentication and uses get or post.

```auto
[{"id":"5a7c93e546f768ac","type":"http request","z":"e05bef77a0d32682","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://pi.hole/api/dns/blocking","tls":"e6a0747206f52725","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"sid","valueType":"msg","valueValue":"responseCookies.sid.value"}],"x":910,"y":460,"wires":[["21739583887237d4"]]},{"id":"de1762d74105c86e","type":"function","z":"e05bef77a0d32682","name":"JSON for blocking","func":"\nmsg.payload = {\n \"blocking\": false,\n \"timer\":msg.disabletime\n}\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":710,"y":460,"wires":[["5a7c93e546f768ac"]]},{"id":"fd9e6054cf2231da","type":"http request","z":"e05bef77a0d32682","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://pi.hole/api/auth","tls":"e6a0747206f52725","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":540,"wires":[["74ddfd8f4b28667d"]]},{"id":"90df7b4d23651043","type":"inject","z":"e05bef77a0d32682","name":"BlockingStatus","props":[{"p":"password","v":"ki53ZSGPpsKlUudCeb8niAVLJYjxaYVr5URUQd8vgvU=","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":120,"y":540,"wires":[["63a5bca3bd866727"]]},{"id":"7bc23abd4b396ec7","type":"debug","z":"e05bef77a0d32682","name":"debug 8","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1240,"y":460,"wires":[]},{"id":"21739583887237d4","type":"json","z":"e05bef77a0d32682","name":"","property":"payload","action":"","pretty":false,"x":1070,"y":460,"wires":[["7bc23abd4b396ec7"]]},{"id":"74ddfd8f4b28667d","type":"http request","z":"e05bef77a0d32682","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://pi.hole/api/dns/blocking","tls":"e6a0747206f52725","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"sid","valueType":"msg","valueValue":"responseCookies.sid.value"}],"x":910,"y":540,"wires":[["94dff76db9688ff9"]]},{"id":"1e19542b8c586c30","type":"debug","z":"e05bef77a0d32682","name":"debug 15","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1240,"y":540,"wires":[]},{"id":"a82dfb57d600b23e","type":"http request","z":"e05bef77a0d32682","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://pi.hole/api/auth","tls":"e6a0747206f52725","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":460,"wires":[["de1762d74105c86e"]]},{"id":"94dff76db9688ff9","type":"json","z":"e05bef77a0d32682","name":"","property":"payload","action":"","pretty":false,"x":1070,"y":540,"wires":[["1e19542b8c586c30"]]},{"id":"5ece500cd619236f","type":"function","z":"e05bef77a0d32682","name":"Authn","func":"msg.payload = {\n \"password\": msg.password\n}\n\nreturn msg;\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":460,"wires":[["a82dfb57d600b23e"]]},{"id":"918f606c918d441f","type":"inject","z":"e05bef77a0d32682","name":"Disable","props":[{"p":"disabletime","v":"900","vt":"num"},{"p":"password","v":"ki53ZSGPpsKlUudCeb8niAVLJYjxaYVr5URUQd8vgvU=","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":460,"wires":[["5ece500cd619236f"]]},{"id":"63a5bca3bd866727","type":"function","z":"e05bef77a0d32682","name":"Authn","func":"msg.payload = {\n \"password\": msg.password\n}\n\nreturn msg;\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":540,"wires":[["fd9e6054cf2231da"]]},{"id":"e6a0747206f52725","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false,"alpnprotocol":""}]

```

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [17 March 2025 22:33 UTC](https://discourse.nodered.org/t/pihole-v6-disable-blocking/96074/2 "2025-03-17T22:33:30Z")

</div>

> [@edje11](#):
>
> [REST api](http://pi.hole/api/docs)

That is a link to _your_ pihole, not global docs.

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [18 March 2025 07:49 UTC](https://discourse.nodered.org/t/pihole-v6-disable-blocking/96074/3 "2025-03-18T07:49:02Z")

</div>

Thanks for pointing me to the error.
