Using REST API to get counts of hosts - filtering or reducing fields

That is the Multisite-API. The deprecated Web-API was only for configuration tasks.

I had success with the following code from the Python example:

resp = session.get(
    f"{API_URL}/domain-types/host/collections/all",
    params={
        "query": '{"op": "~", "left": "filename", "right": "/wato/folder"}',
        "columns": ['name', 'filename'],
    },
)