Hi everyone,
I'm having problems finding where to get an api key when using the newest Web interface.
Do you know where I can find it ?
Hi everyone,
I'm having problems finding where to get an api key when using the newest Web interface.
Do you know where I can find it ?
http://pi.hole/api or https://pi.hole/api depending on how you access your Pi-Hole
But keep in mind that the piece of software you are using might need adjustments too by the person who made it !!
I get this:
{
"error": {
"key": "not_found",
"message": "Not found",
"hint": "/api"
},
"took": 0.000055789947509765
}
What are you doing ?
What are you trying to achieve ?
Which software are you using ?
Im trying to make a bot that notify me when certain domains appear in the queries. And for that I'd like to use the api access.
Have a read of Pi-hole API - Pi-hole documentation, specifically Authentication - Pi-hole documentation.
You'll find that Pi-hole's new REST API is fully documented, allowing for immediate interactive testing of API commands directly from the documentation, available locally at http://pi.hole/api/docs.
You'd just need to configure and enable an app password via Settings | Web Interface - API in Expert mode and enter that into the local doc page.
I can't reach the site
pi.hole’s DNS address could not be found. Diagnosing the problem.
DNS_PROBE_POSSIBLE
Then use the IP of your local Pi-hole: http://<your_pihole_IP>/api/docs
Thank you, your response helped me with my auth issues. I am now able to turn blocking on and off but I cannot figure out how to add a time value for the disable. Is there a way to set a time for the disable via the API.
Also, on the older API I was able to generate a key and then use it with a simple curl script to enable and disable the pihole. Now it seems that I have to first make a call with my api key and get an sid key to use for the API calls. Am I missing somethig or is the only path to making REST calls?
Thanks!
Yes.
To set a time of 30 seconds, add "timer":30
to your JSON payload.
now when I try any of the commands I get:
Response Status: Failed to fetch (CORS or Network Issue)
fixed it ! I had to change the url in the server variables
I had tried that but when I viewed the web gui it continued to show the blocking as simply "Disabled". When you select a set time through the UI the button is displayed with a countdown timer. This led me to believe that a time was in fact not being set.
So, I made the API call with the API and then set a timer to 30 seconds, the blocking never did re-enalbe itselft.
This is my payload
{
"config": {
"dns": {
"blocking": {
"active": false,
"timer":30
}
}
}
}
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.