Help creating a cable for Netbox 4.2.5 #673
-
Hi, I have this script to test the creation of a cable using pynetbox (7.4.1) on Netbox 4.2.5:
But when I run it, got this error:
If I feed the contents of cable_data into Cable Bulk Import --> Direct Import the cable is successfully created. Can anyone point me to what am I doing wrong? TIA |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
did you ever find a solution to this error? I am getting the same. |
Beta Was this translation helpful? Give feedback.
-
If you want to create a cable in NetBox using the API (v3+), use the cable_data = {
"type": "mmf-om4", # Cable type (adjust as needed)
"a_terminations": [
{
"object_type": "dcim.interface",
"object_id": local_interface_id # The NetBox ID of the local interface
}
],
"b_terminations": [
{
"object_type": "dcim.interface",
"object_id": remote_interface_id # The NetBox ID of the remote interface
}
],
"color": "00ffff", # Cable color (6-char hex, no #)
"status": "connected",
# Optionally add label, length, length_unit, etc.
} Notes:
This format should work with the |
Beta Was this translation helpful? Give feedback.
If you want to create a cable in NetBox using the API (v3+), use the
a_terminations
andb_terminations
fields as shown below. This matches the format required by the NetBox Swagger documentation.