netbox-community / go-netbox

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

Error creating ipam prefix #62

Closed smutel closed 4 years ago

smutel commented 4 years ago

When I create a new ipam prefix with this library, I received an error message as below:

Error: json: cannot unmarshal number into Go struct field PrefixFamily.family.value of type string

The json received by Netbox is like the following:

{
  "id":1,
  "family":{
    "value":4,
    "label": "IPv4"
  },
  "prefix":"192.168.56.0/24",
  "site":null,
  "vrf":null,
  "tenant":null,
  "vlan": {
    "id":2,
    "url":"http://127.0.0.1:32768/api/ipam/vlans/2/",
    "vid":100,
    "name":"Test_Vlan",
    "display_name":"100 (Test_Vlan)"},
    "status": {
      "value":"container",
      "label":"Container",
      "id":0
    },
    "role":null,
    "is_pool":false,
    "description":"Prefix created by terraform",
    "tags":["tag1"],
    "custom_fields":{},
    "created":"2020-03-14",
    "last_updated":"2020-03-14T16:26:39.044374Z"
}