Using API in Gravity Update

Using API in Gravity Update

Hi, I want to make Gravity update automatic. For this, since I am using Pi-hole Docker version, it made sense to send a request to the endpoint in the UI interface. (If I had installed directly, I would have triggered it with cron using sh.)

However, when I tried to send a request with auth in the API field ({BaseURL}/admin/settings.php?tab=api) in Settings, it did not work.

Request:
{BaseURL}/admin/scripts/pi-hole/php/gravity.sh.php?auth=[Auth]

Sources I reviewed:

My goal is to update daily between 3-5 am every morning.

You can still use cron with docker installation.

You just need to use docker exec command in your cron job to run the command inside the container.

docker exec <Pi-hole_container_name> <command>

# In this example, the container name is "Pihole"
docker exec Pihole pihole -g

The container already does that OOTB:

EDIT: Why do you want to schedule it daily?
That only burdens the adlist providers with extra network traffic.
And you have more writes on your filesystem.
Plus when it transitions from old db to new db during a gravity pull, ads wont get blocked.
For a very short period but still.

Thanks. This seems to work for me.

In fact, it was starting to get a little tiring to constantly go to the update gravity page as it took a long time and create my own piHole list.