From bab50ebfc49c95ee37f8be061e85d4b8d6494675 Mon Sep 17 00:00:00 2001 From: Vegard Engen Date: Sun, 13 Apr 2025 15:20:13 +0200 Subject: [PATCH] Unifi API v2 --- unifi/unifi.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/unifi/unifi.go b/unifi/unifi.go index 516a9a9..043781f 100644 --- a/unifi/unifi.go +++ b/unifi/unifi.go @@ -212,6 +212,9 @@ func (c *Client) do(ctx context.Context, method, relativeURL string, reqBody int if err != nil { return fmt.Errorf("unable to parse URL: %s %s %w", method, relativeURL, err) } + if !strings.Contains(relativeURL, "firewall/zone") { + c.apiPath = c.apiV2Path + } if !strings.HasPrefix(relativeURL, "/") && !reqURL.IsAbs() { reqURL.Path = path.Join(c.apiPath, reqURL.Path) }