Pi-hole icon

Pi-hole

Get information from Pi-hole API

Actions10

Overview

This n8n node interacts with the Pi-hole API to retrieve information about the API version. Specifically, when configured with Resource: ApiVersion and Operation: Get, it sends a request to the specified Pi-hole instance and returns the current API version (either 2 or 3). This is useful for automation scenarios where you need to verify compatibility, perform conditional logic based on API capabilities, or simply document the environment.

Practical examples:

  • Automatically check the Pi-hole API version before running further automated tasks.
  • Use in workflows that must adapt to different Pi-hole API versions.
  • Integrate with monitoring tools to report or alert on API version changes.

Properties

Name Type Meaning
API Url String The base URL of your Pi-hole API endpoint. Example: http://localhost/admin/api.php. Required for connecting to your Pi-hole instance.

Output

The node outputs a JSON object containing the API version information as returned by the Pi-hole API. The structure typically looks like:

{
  "api_version": 2
}

or

{
  "api_version": 3
}
  • The exact property name may vary depending on the Pi-hole API response, but it will indicate the API version (e.g., api_version).

Dependencies

  • Pi-hole Instance: You must have access to a running Pi-hole server with its API enabled.
  • API Url: The correct URL to your Pi-hole's API endpoint is required.
  • n8n Configuration: No special credentials are required for this operation, but ensure network connectivity between n8n and your Pi-hole server.

Troubleshooting

  • Common Issues:

    • Incorrect API Url: If the API Url is wrong or unreachable, you may receive connection errors or timeouts.
    • Invalid Response: If the Pi-hole API does not return the expected data, the output may be empty or malformed.
    • Network Issues: Firewalls or network restrictions can block requests from n8n to Pi-hole.
  • Error Messages & Resolutions:

    • "ECONNREFUSED" or "ENOTFOUND": Check that the API Url is correct and the Pi-hole server is running and accessible.
    • "Unexpected token" or JSON parse errors: Ensure the Pi-hole API is returning valid JSON; check for misconfiguration or server issues.

Links and References

Discussion