Error while creating console server ports via API #5683

Closed
opened 2025-12-29 19:31:28 +01:00 by adam · 1 comment
Owner

Originally created by @VictorPavlushin on GitHub (Nov 18, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.0.8

Python version

3.9

Steps to Reproduce

If you pass a zero port speed value ("speed": null) when creating console server ports via the API, an error is generated: {"error": "Field 'speed' expected a number but got ''.", "Exception": "ValueError "," netbox_version ":" 3.0.8 "," python_version ":" 3.9.2 "}.
The documentation says:

speed	integer
    title: Speed
    x-nullable: true

Steps:

# curl -X POST http://localhost:8001/api/dcim/console-server-ports/ -H 'Content-Type: application/json' -H "Authorization: TOKEN 0000000000000000000000000000000000000" -d '{"description": "", "device": 9081, "label": "", "mark_connected": false, "name": "USB1", "speed": null, "tags": [], "type": "usb-b"}'
{"error": "Field 'speed' expected a number but got ''.", "exception": "ValueError", "netbox_version": "3.0.8", "python_version": "3.9.2"}

# curl -X POST http://localhost:8001/api/dcim/console-server-ports/ -H 'Content-Type: application/json' -H "Authorization: TOKEN 0000000000000000000000000000000000000" -d '{"description": "", "device": 9081, "label": "", "mark_connected": false, "name": "USB1", "tags": [], "type": "usb-b"}'
{"id":97,"url":"http://localhost:8001/api/dcim/console-server-ports/97/","display":"USB1","device":{"id":9081,"url":"http://localhost:8001/api/dcim/devices/9081/","display":"DEVISENAME","name":null},"name":"USB1","label":"","type":{"value":"usb-b","label":"USB Type B"},"speed":null,"description":"","mark_connected":false,"cable":null,"cable_peer":null,"cable_peer_type":null,"connected_endpoint":null,"connected_endpoint_type":null,"connected_endpoint_reachable":null,"tags":[],"custom_fields":{},"created":"2021-11-18","last_updated":"2021-11-18T15:11:54.867474+07:00","_occupied":false}

Expected Behavior

Successful device creation

Observed Behavior

Got out the error

Originally created by @VictorPavlushin on GitHub (Nov 18, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.0.8 ### Python version 3.9 ### Steps to Reproduce If you pass a zero port speed value (`"speed": null`) when creating console server ports via the API, an error is generated: `{"error": "Field 'speed' expected a number but got ''.", "Exception": "ValueError "," netbox_version ":" 3.0.8 "," python_version ":" 3.9.2 "}`. The documentation says: ``` speed integer title: Speed x-nullable: true ``` Steps: ``` # curl -X POST http://localhost:8001/api/dcim/console-server-ports/ -H 'Content-Type: application/json' -H "Authorization: TOKEN 0000000000000000000000000000000000000" -d '{"description": "", "device": 9081, "label": "", "mark_connected": false, "name": "USB1", "speed": null, "tags": [], "type": "usb-b"}' {"error": "Field 'speed' expected a number but got ''.", "exception": "ValueError", "netbox_version": "3.0.8", "python_version": "3.9.2"} # curl -X POST http://localhost:8001/api/dcim/console-server-ports/ -H 'Content-Type: application/json' -H "Authorization: TOKEN 0000000000000000000000000000000000000" -d '{"description": "", "device": 9081, "label": "", "mark_connected": false, "name": "USB1", "tags": [], "type": "usb-b"}' {"id":97,"url":"http://localhost:8001/api/dcim/console-server-ports/97/","display":"USB1","device":{"id":9081,"url":"http://localhost:8001/api/dcim/devices/9081/","display":"DEVISENAME","name":null},"name":"USB1","label":"","type":{"value":"usb-b","label":"USB Type B"},"speed":null,"description":"","mark_connected":false,"cable":null,"cable_peer":null,"cable_peer_type":null,"connected_endpoint":null,"connected_endpoint_type":null,"connected_endpoint_reachable":null,"tags":[],"custom_fields":{},"created":"2021-11-18","last_updated":"2021-11-18T15:11:54.867474+07:00","_occupied":false} ``` ### Expected Behavior Successful device creation ### Observed Behavior Got out the error
adam added the type: bugstatus: accepted labels 2025-12-29 19:31:28 +01:00
adam closed this issue 2025-12-29 19:31:28 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 18, 2021):

The same issue appears to apply to console ports as well (see #7866).

@jeremystretch commented on GitHub (Nov 18, 2021): The same issue appears to apply to console ports as well (see #7866).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5683