Get Interface in API don't return required Device attributes #9800

Closed
opened 2025-12-29 21:22:52 +01:00 by adam · 3 comments
Owner

Originally created by @janhlavin on GitHub (Jun 5, 2024).

Deployment Type

Self-hosted

NetBox Version

v4.0.3

Python Version

3.11

Steps to Reproduce

  1. create Manufacturer, Device type, Device role, Site and Device+Interface
  2. call GET to /api/dcim/interfaces/$InterfaceID/

Expected Behavior

in object of attribute "device" all required attributes:

image

Observed Behavior

in object of attribute "device" is only attributes:

  • id
  • url
  • display
  • name
  • description
Originally created by @janhlavin on GitHub (Jun 5, 2024). ### Deployment Type Self-hosted ### NetBox Version v4.0.3 ### Python Version 3.11 ### Steps to Reproduce 1. create Manufacturer, Device type, Device role, Site and Device+Interface 2. call GET to /api/dcim/interfaces/$InterfaceID/ ### Expected Behavior in object of attribute "device" all required attributes: <img width="236" alt="image" src="https://github.com/netbox-community/netbox/assets/98013382/4a8dd6f7-fcef-43b1-a040-6d5fca0e354d"> ### Observed Behavior in object of attribute "device" is only attributes: * id * url * display * name * description
adam closed this issue 2025-12-29 21:22:53 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jun 5, 2024):

This is expected behavior. The REST API is functioning as designed.

@jeremystretch commented on GitHub (Jun 5, 2024): This is expected behavior. The REST API is functioning as designed.
Author
Owner

@janhlavin commented on GitHub (Jun 5, 2024):

This is expected behavior. The REST API is functioning as designed.

but GOlang call (generated from Swagger schema in https://github.com/netbox-community/go-netbox) fail with "no value given for required property device_type"

@janhlavin commented on GitHub (Jun 5, 2024): > This is expected behavior. The REST API is functioning as designed. but GOlang call (generated from Swagger schema in https://github.com/netbox-community/go-netbox) fail with "no value given for required property device_type"
Author
Owner

@c42-konstantin commented on GitHub (Aug 23, 2024):

Actually, the same happens for the simple DcimDevicesList() on Netbox: netbox-8566b965fb-6t4sh (v4.0.9).
A quick example:

package main

import (
	"context"
	"log"
	
	"github.com/netbox-community/go-netbox/v4"
)

func main() {
	ctx := context.Background()
	nb := netbox.NewAPIClientFor("https://CUT", "CUT")
	
	_, out, err := nb.DcimAPI.DcimDevicesList(ctx).Execute()
	if err != nil {
		log.Printf("Status: %s\n", out.Status)
		log.Printf("Body: %s\n", out.Body)
		log.Fatal(err.Error())
	}
}

out:
2024/08/23 11:25:58 Status: 200 OK 2024/08/23 11:25:58 Body: {{"count":1,"next":null,"previous":null,"results":[{"id":1237,"url":"https://netbox.local/api/dcim/devices/1237/","display":"test-device","name":"test-device","device_type":{"id":81,"url":"https://netbox.local/api/dcim/device-types/81/","display":"testconfig1","manufacturer":{"id":4,"url":"https://netbox.local/api/dcim/manufacturers/4/","display":"taiga","name":"taiga","slug":"taiga","description":""},"model":"testconfig1","slug":"testconfig1","description":""},"role":{"id":13,"url":"https://netbox.local/api/dcim/device-roles/13/","display":"unknown","name":"unknown","slug":"unknown","description":""},"tenant":null,"platform":null,"serial":"","asset_tag":null,"site":{"id":30,"url":"https://netbox.local/api/dcim/sites/30/","display":"unknown","name":"unknown","slug":"unknown","description":""},"location":null,"rack":null,"position":null,"face":null,"latitude":null,"longitude":null,"parent_device":null,"status":{"value":"active","label":"Active"},"airflow":null,"primary_ip":null,"primary_ip4":null,"primary_ip6":null,"oob_ip":null,"cluster":null,"virtual_chassis":null,"vc_position":null,"vc_priority":null,"description":"","comments":"","config_template":null,"config_context":{},"local_context_data":null,"tags":[],"custom_fields":{"taiga_uuid":null},"created":"2024-08-23T11:01:16.670159+04:00","last_updated":"2024-08-23T11:01:16.670173+04:00","console_port_count":0,"console_server_port_count":0,"power_port_count":0,"power_outlet_count":0,"interface_count":0,"front_port_count":0,"rear_port_count":0,"device_bay_count":0,"module_bay_count":0,"inventory_item_count":0}]}} 2024/08/23 11:25:58 no value given for required property device_count exit status 1

@c42-konstantin commented on GitHub (Aug 23, 2024): Actually, the same happens for the simple DcimDevicesList() on Netbox: netbox-8566b965fb-6t4sh (v4.0.9). A quick example: ```go package main import ( "context" "log" "github.com/netbox-community/go-netbox/v4" ) func main() { ctx := context.Background() nb := netbox.NewAPIClientFor("https://CUT", "CUT") _, out, err := nb.DcimAPI.DcimDevicesList(ctx).Execute() if err != nil { log.Printf("Status: %s\n", out.Status) log.Printf("Body: %s\n", out.Body) log.Fatal(err.Error()) } } ``` out: ` 2024/08/23 11:25:58 Status: 200 OK 2024/08/23 11:25:58 Body: {{"count":1,"next":null,"previous":null,"results":[{"id":1237,"url":"https://netbox.local/api/dcim/devices/1237/","display":"test-device","name":"test-device","device_type":{"id":81,"url":"https://netbox.local/api/dcim/device-types/81/","display":"testconfig1","manufacturer":{"id":4,"url":"https://netbox.local/api/dcim/manufacturers/4/","display":"taiga","name":"taiga","slug":"taiga","description":""},"model":"testconfig1","slug":"testconfig1","description":""},"role":{"id":13,"url":"https://netbox.local/api/dcim/device-roles/13/","display":"unknown","name":"unknown","slug":"unknown","description":""},"tenant":null,"platform":null,"serial":"","asset_tag":null,"site":{"id":30,"url":"https://netbox.local/api/dcim/sites/30/","display":"unknown","name":"unknown","slug":"unknown","description":""},"location":null,"rack":null,"position":null,"face":null,"latitude":null,"longitude":null,"parent_device":null,"status":{"value":"active","label":"Active"},"airflow":null,"primary_ip":null,"primary_ip4":null,"primary_ip6":null,"oob_ip":null,"cluster":null,"virtual_chassis":null,"vc_position":null,"vc_priority":null,"description":"","comments":"","config_template":null,"config_context":{},"local_context_data":null,"tags":[],"custom_fields":{"taiga_uuid":null},"created":"2024-08-23T11:01:16.670159+04:00","last_updated":"2024-08-23T11:01:16.670173+04:00","console_port_count":0,"console_server_port_count":0,"power_port_count":0,"power_outlet_count":0,"interface_count":0,"front_port_count":0,"rear_port_count":0,"device_bay_count":0,"module_bay_count":0,"inventory_item_count":0}]}} 2024/08/23 11:25:58 no value given for required property device_count exit status 1 `
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9800