Skip to content

Error while creating console server ports via API #7865

@VictorPavlushin

Description

@VictorPavlushin

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

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions