netbox-community / go-netbox

The official Go API client for Netbox IPAM and DCIM service.
Other
192 stars 141 forks source link

Unexpected error return from IpamPrefixesList #177

Open tgoodsell-tempus opened 1 month ago

tgoodsell-tempus commented 1 month ago

When running the following function:

package main

import (
    "context"
    "log"
    "os"

    "github.com/netbox-community/go-netbox/v4"
)

func main() {
    ctx := context.Background()

    client := netbox.NewAPIClientFor("https://netbox.zro.gcp.tempus.cloud", os.Getenv("NETBOX_API_TOKEN"))

    prefixList, resp, err := client.IpamAPI.IpamPrefixesList(ctx).Execute()
    if err != nil {
        log.Printf("Num returned: %d", len(prefixList.Results))
        log.Printf("HTTP RESP: %v", resp)
        log.Fatalf("Failed to get prefixes: %v", err)
    }
}

I'm seeing results where:

Netbox version being run: v4.0.3

Based on the value of the response, I gather this is an issue with the parsing of this request, rather than an actual API issue.