Error while creating console ports via API #5685

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

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

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 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-ports/ -H 'Content-Type: application/json' -H "Authorization: TOKEN 0000000000000000000000000000000000000" -d '{"description": "", "device": 6653, "label": "", "mark_connected": false, "name": "con0", "speed": null, "tags": [], "type": "rj-45"}'
{"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-ports/ -H 'Content-Type: application/json' -H "Authorization: TOKEN 0000000000000000000000000000000000000" -d '{"description": "", "device": 6653, "label": "", "mark_connected": false, "name": "con0", "tags": [], "type": "rj-45"}'   
{"id":739,"url":"http://localhost:8001/api/dcim/console-ports/739/","display":"con0","device":{"id":6653,"url":"http://localhost:8001/api/dcim/devices/6653/","display":"DEVICENAME","name":"DEVICENAME"},"name":"con0","label":"","type":{"value":"rj-45","label":"RJ-45"},"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-18T16:23:44.269904+07:00","_occupied":false}

Expected Behavior

Successful console ports creation

Observed Behavior

Got out the error

Originally created by @VictorPavlushin on GitHub (Nov 18, 2021). ### 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 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-ports/ -H 'Content-Type: application/json' -H "Authorization: TOKEN 0000000000000000000000000000000000000" -d '{"description": "", "device": 6653, "label": "", "mark_connected": false, "name": "con0", "speed": null, "tags": [], "type": "rj-45"}' {"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-ports/ -H 'Content-Type: application/json' -H "Authorization: TOKEN 0000000000000000000000000000000000000" -d '{"description": "", "device": 6653, "label": "", "mark_connected": false, "name": "con0", "tags": [], "type": "rj-45"}' {"id":739,"url":"http://localhost:8001/api/dcim/console-ports/739/","display":"con0","device":{"id":6653,"url":"http://localhost:8001/api/dcim/devices/6653/","display":"DEVICENAME","name":"DEVICENAME"},"name":"con0","label":"","type":{"value":"rj-45","label":"RJ-45"},"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-18T16:23:44.269904+07:00","_occupied":false} ``` ### Expected Behavior Successful console ports creation ### Observed Behavior Got out the error
adam added the type: bug label 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):

This can be addressed under #7865.

@jeremystretch commented on GitHub (Nov 18, 2021): This can be addressed under #7865.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5685