Closed davidroman0O closed 3 years ago
Hi,
I'm just trying to try the package but I got an issue when trying to get the list of racks:
package main import ( "context" "fmt" "os" "github.com/netbox-community/go-netbox/netbox" "github.com/netbox-community/go-netbox/netbox/client/dcim" ) func main() { c := netbox.NewNetboxWithAPIKey("localhost:6565", "mytokenwhatever") var limit int64 = 10 var params dcim.DcimRacksListParams = dcim.DcimRacksListParams{ Context: context.Background(), Limit: &limit, } rs, err := c.Dcim.DcimRacksList(¶ms, nil) if err != nil { fmt.Printf("%v\n", err) os.Exit(1) } fmt.Printf("%v\n", *(rs.Payload.Count)) }
And I got :
json: cannot unmarshal number into Go struct field RackStatus.results.status.value of type string exit status 1
The error is right, I tried to call the api with postman and I got :
"status": { "value": 0, "label": "Reserved" },
But when looking at https://github.com/netbox-community/go-netbox/blob/master/netbox/models/rack.go, I see that RackStatus.value need a string.
https://github.com/netbox-community/go-netbox/blob/master/netbox/models/rack.go
I tried to use the latest and netbox_v2.6 versions of this package, same thing!
latest
netbox_v2.6
Any idea or a workaround for that?
Thx for your work 😄
Have same problem. json: cannot unmarshal number into Go struct field VLANStatus.results.status.value of type string<nil>
json: cannot unmarshal number into Go struct field VLANStatus.results.status.value of type string<nil>
netbox 2.6.6
Hi,
I'm just trying to try the package but I got an issue when trying to get the list of racks:
And I got :
The error is right, I tried to call the api with postman and I got :
But when looking at
https://github.com/netbox-community/go-netbox/blob/master/netbox/models/rack.go
, I see that RackStatus.value need a string.I tried to use the
latest
andnetbox_v2.6
versions of this package, same thing!Any idea or a workaround for that?
Thx for your work 😄