Skip to content

Fix missing compatibility to Pi-hole V5 API (minimal changes)#322

Merged
SourceDoctor merged 1 commit intolibrenms:masterfrom
efelon:master
Jul 18, 2020
Merged

Fix missing compatibility to Pi-hole V5 API (minimal changes)#322
SourceDoctor merged 1 commit intolibrenms:masterfrom
efelon:master

Conversation

@efelon
Copy link
Contributor

@efelon efelon commented Jul 17, 2020

To minimize the impact of future API changes in terms of data order or additional data being appended, required elements are selected directly with the "jq" tool in the expected order.

In theory this change should be backwards compatible to the previous version of the Pi-hole API, but I don't have access to an older version (V4 API) to test it.

To minimize the impact of future API changes in terms of data order or additional data being appended, required elements are selected directly with the jq tool in the expected order.
@efelon efelon changed the title Fix missing compatibility to Pi-hole V5 API Fix missing compatibility to Pi-hole V5 API (minimal changes) Jul 17, 2020
@SourceDoctor
Copy link
Member

is it maybe possible to get the API Version which is used and then switch command for it to ensure old versions stay functional?

@elherr
Copy link

elherr commented Jul 18, 2020

Thanks for updating the script! Added changes from master and your commit on my system with Pi-hole 5.1 (latest) and works well. Current API is version 3.
$ curl -s http://localhost/admin/api.php/?version | jq
{
"version": 3
}

@efelon
Copy link
Contributor Author

efelon commented Jul 18, 2020

@SourceDoctor I think it should also work with the previous version of the API. But, as I wrote in the PR, I don't have a Pi-hole 4 installation around. Someone confirming my assumption would be really great.

And then of course if it is not working I can add a API version check as suggested by @elherr.

@SourceDoctor SourceDoctor merged commit 506405d into librenms:master Jul 18, 2020
@elherr
Copy link

elherr commented Jul 18, 2020

@efelon I'd hope no one with LibreNMS installed is using the old Pi-hole API at this point. If they are using old version of Pi-hole, I would have to guess they are not actively updating LibreNMS either.

perceival pushed a commit to perceival/librenms-agent that referenced this pull request Mar 13, 2026
To minimize the impact of future API changes in terms of data order or additional data being appended, required elements are selected directly with the jq tool in the expected order.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants