Closed kplimack closed 3 years ago
I am seeing a similar problem, using Netbox v2.10.4:
// (When 1234 and 5678 are valid rear/front ports)
terminationAType := "dcim.rearport"
var rearPort int64 = 1234
terminationBType := "dcim.frontport"
var frontPort int64 = 5678
label := "foo"
cableParams := dcim.NewDcimCablesCreateParams()
cableParams.Data = &models.WritableCable{
TerminationaType: &terminationAType,
TerminationaID: &rearPort,
TerminationbType: &terminationBType,
TerminationbID: &frontPort,
Label: label,
}
_, err := nb.Dcim.DcimCablesCreate(cableParams, nil)
if err != nil {
fmt.Println(err)
}
Prints:
cannot unmarshal number into Go struct field Cable.termination_a of type string
The cable gets successfully created in Netbox and via Wireshark I can see the expected response. It seems whatever data definition go-netbox
is using is incorrect.
Let me know if this should be filed as a separate issue.
When I make any get/list request to the API (using the example code from github README), I get unmarshal errors
Looking at the JSON response from Netbox, it looks like its getting back an int that its not casting to a string for "value"