API returns []

I'm looking to get the stats from my pihole instance via the API

I have a task using the http request action, but it seems to return nothing:

    Task: Pihole Status
    
    A1: HTTP Request [
         Method: GET
         URL: http://pi.hole/admin/api.php
         Query Parameters: summaryRaw
         Timeout (Seconds): 30
         Structure Output (JSON, etc): On ]

I'd also like to use it to disable / enable pihole

Thanks

Expected Behaviour:

api call returns data in JSON, and enables / disabled

Actual Behaviour:

summary and SummaryRaw returns empty square brackets when including token http://pi.hole/admin/api.php?summary&auth=<mytoken>

This usually means an authorization failure.

Try this endpoint: http://pi.hole/admin/api.php?versions (it doesn't need the token)

If this endpoint is not returning Pi-hole versions, then you need to check your connectivity.
If it is returning the correct answer, your need to make sure you are using the correct authorization token.

Login, go to Settings page, API tab and click here:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.