Skip to content

Cannot unmarshal object _PaginatedInterfaceList.results of type int32 #170

Closed
@olekgo

Description

@olekgo

Go-netbox version v3.7.1-alpha.0, Netbox version 86a6c2367494 (v3.7.1) getting following error:

json: cannot unmarshal object into Go struct field _PaginatedInterfaceList.results of type int32`

When running the following code

package main

import (
	"context"
	"log"

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

func main() {
	ctx := context.Background()
	c := netbox.NewAPIClientFor("http://localhost:8080", "somekey")
	_, _, err := c.DcimAPI.DcimInterfacesList(ctx).Id([]int32{6332}).Execute()
	if err != nil {
		log.Fatal(err)

	}
}

The interface that is causing issues

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 6943,
            "url": "http://localhost:8080/api/dcim/interfaces/6943/",
            "display": "ge-0/0/1",
            "device": {
                "id": 344,
                "url": "http://localhost:8080/api/dcim/devices/344/",
                "display": "fw1.lab",
                "name": "fw1.lab"
            },
            "vdcs": [],
            "module": null,
            "name": "ge-0/0/1",
            "label": "",
            "type": {
                "value": "1000base-t",
                "label": "1000BASE-T (1GE)"
            },
            "enabled": true,
            "parent": null,
            "bridge": null,
            "lag": null,
            "mtu": 9188,
            "mac_address": null,
            "speed": null,
            "duplex": null,
            "wwn": null,
            "mgmt_only": false,
            "description": "",
            "mode": {
                "value": "tagged",
                "label": "Tagged"
            },
            "rf_role": null,
            "rf_channel": null,
            "poe_mode": null,
            "poe_type": null,
            "rf_channel_frequency": null,
            "rf_channel_width": null,
            "tx_power": null,
            "untagged_vlan": null,
            "tagged_vlans": [
                {
                    "id": 88,
                    "url": "http://localhost:8080/api/ipam/vlans/88/",
                    "display": "default (1)",
                    "vid": 1,
                    "name": "default"
                },
                {
                    "id": 89,
                    "url": "http://localhost:8080/api/ipam/vlans/89/",
                    "display": "guest (8)",
                    "vid": 8,
                    "name": "guest"
                }
            ],
            "mark_connected": false,
            "cable": {
                "id": 11,
                "url": "http://localhost:8080/api/dcim/cables/11/",
                "display": "#11",
                "label": ""
            },
            "cable_end": "A",
            "wireless_link": null,
            "link_peers": [
                {
                    "id": 7013,
                    "url": "http://localhost:8080/api/dcim/interfaces/7013/",
                    "display": "ge-0/0/47",
                    "device": {
                        "id": 345,
                        "url": "http://localhost:8080/api/dcim/devices/345/",
                        "display": "sw1.lab",
                        "name": "sw1.lab"
                    },
                    "name": "ge-0/0/47",
                    "cable": 11,
                    "_occupied": true
                }
            ],
            "link_peers_type": "dcim.interface",
            "wireless_lans": [],
            "vrf": null,
            "l2vpn_termination": null,
            "connected_endpoints": [
                {
                    "id": 7013,
                    "url": "http://localhost:8080/api/dcim/interfaces/7013/",
                    "display": "ge-0/0/47",
                    "device": {
                        "id": 345,
                        "url": "http://localhost:8080/api/dcim/devices/345/",
                        "display": "sw1.lab",
                        "name": "sw1.lab"
                    },
                    "name": "ge-0/0/47",
                    "cable": 11,
                    "_occupied": true
                }
            ],
            "connected_endpoints_type": "dcim.interface",
            "connected_endpoints_reachable": true,
            "tags": [],
            "custom_fields": {
                "ipv4_filter_input": null,
                "ipv4_filter_output": null,
                "link_setup": null,
                "native_vlan_id": null,
                "security_zone": null
            },
            "created": "2024-04-03T20:19:45.267356Z",
            "last_updated": "2024-04-03T20:31:59.794948Z",
            "count_ipaddresses": 0,
            "count_fhrp_groups": 0,
            "_occupied": true
        }
    ]
}

Likely related to #151

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions