Skip to content

REST API: GET a cable by providing termination ids and termination types #7394

@rmammadli

Description

@rmammadli

NetBox version

v3.0.0

Feature type

Data model extension

Proposed functionality

There are currently ~ 2500 cables within our netbox instance and it is going to grow rapidly in near future.

Current version of Netbox API does not offer possibility to get / filter cable(s) using termination values (id, type).

To create / update a cable, we firstly need check if there is already cable exsiting with given data below:

  • termination_a_id
  • termination_a_type
  • termination_b_id
  • termination_b_type

For that we need execute GET request to obtain all cables from Netbox API and then execute search in obtained data additionally.

Benchmarks:

with default values for limit and offset to GET cables:

curl -s -X GET -H "Authorization: Token $TOKEN" -H "Content-Type: application/json" https://my_netbox_instance/api/dcim/cables/?limit=50&offset50

real 0m2,236s
user 0m0,000s
sys 0m0,062s

GET all cables, limit=0:

curl -s -X GET -H "Authorization: Token $TOKEN" -H "Content-Type: application/json" https://my_netbox_instance/api/dcim/cables/?limit=0

real 0m47,855s
user 0m0,015s
sys 0m0,046s

Use case

Netbox users will be able to search for certain cable with using parameters below:

  • termination_a_id
  • termination_a_type
  • termination_b_id
  • termination_b_type

GET request in Netbox API with these parameters should be faster in comparison with GET all cables.

Database changes

No response

External dependencies

No response

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions