Skip to content

feat: add DNS/FTL log endpoints and group batch-delete - #130

Merged
mikemadeja merged 1 commit into
developfrom
feature/logs-and-group-batch-delete
Sep 30, 2026
Merged

mikemadeja merged 1 commit into
developfrom
feature/logs-and-group-batch-delete

Conversation

@mikemadeja

Copy link
Copy Markdown
Owner

Summary

  • Add Get-PiHoleLogDnsmasq (GET /logs/dnsmasq) and Get-PiHoleLogFtl (GET /logs/ftl), completing the Logs API area
  • Rework Remove-PiHoleGroup to delete multiple groups in one POST /groups:batchDelete call, with an existence pre-check for every name so it never falsely reports a nonexistent group as deleted (the batch API silently no-ops on missing names)
  • Fix a real bug in the batch body construction: for a single group name, the foreach result unwraps to a bare hashtable instead of a one-element array, so ConvertTo-Json serialized it as a JSON object instead of an array, causing the API to reject single-group deletes with 400. Building the body with @() and calling ConvertTo-Json -InputObject (instead of piping) fixes both the single- and multi-name cases correctly

Test plan

  • Get-PiHoleLogDnsmasq / Get-PiHoleLogFtl integration tests pass against a live server (8/8)
  • Remove-PiHoleGroup integration tests pass against a live server (6/6), including a batch of 3 groups created and deleted together, with no settle-time workarounds needed
  • PSScriptAnalyzer clean across the module
  • Non-integration unit suite passes
  • README.md / docs/EXAMPLES.md regenerated

🤖 Generated with Claude Code

Adds Get-PiHoleLogDnsmasq and Get-PiHoleLogFtl (GET /logs/dnsmasq,
GET /logs/ftl), completing the Logs API area. Reworks Remove-PiHoleGroup
to delete multiple groups in a single POST /groups:batchDelete call
while still validating every name exists first, since the batch API
silently no-ops for names that don't exist.

Fixes a latent bug in the batch body construction: a single-name
foreach result unwraps to a bare hashtable instead of a one-element
array, which ConvertTo-Json then serializes as a JSON object instead
of an array - causing the API to reject single-group deletes with 400.
Building the body with @() and passing it via ConvertTo-Json
-InputObject (instead of piping) fixes both the single- and
multi-name cases.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@mikemadeja
mikemadeja merged commit 07f4bdd into develop Sep 30, 2026
3 checks passed
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.

1 participant