The simple answer is: because no one created functions to compute and expose blocked queries per client.
The API was originally created to supply information to the web interface and the web interface never showed this specific metric per client.
The closest thing you can find is the "Top Clients (blocked)" table, on the dashboard. This table uses the stats/top_clients API endpoint.
This endpoint can return only blocked queries when you add blocked=true. It can also show any number of clients. Just add count=N (N must be greater than 0).
curl -X GET "http://pi.hole/api/stats/top_clients?blocked=true&count=50" \
-H 'accept: application/json'\
-H 'sid: <use_a_valid_SID>'
You can also open a Feature Request here on Discourse, requesting that endpoint.
Thank you for your help, how do we make a feature request? I create a normal post?
Create a new topic on the Feature Request category.
If you have 50 Clients or less and let the webGUI or API show a maximum of 50 Top Blocked Clients then IMHO you would achieve exactly what @nininini would like to see or am I wrong here ?!
Not exactly. There is a difference:
-
if an user wants an API endpoint that returns a list with all clients and the count of blocked queries, this is exactly what
/stats/top_clientsdoes. -
an user wants the number of blocked queries just for a specific client, then a new API endpoint is needed.