REST API: dcim/interfaces has count_ipaddresses, while virtualization/interfaces does not #4710

Closed
opened 2025-12-29 19:19:42 +01:00 by adam · 0 comments
Owner

Originally created by @eikef on GitHub (Mar 30, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v2.10.6

Feature type

Change to existing functionality

Proposed functionality

Currently the /api/dcim/interfaces-endpoint provides a convenient read-only count_ipaddresses field in its return, whereas the /api/virtualization/interfaces-endpoint does not -- although the latter can have IP addresses assigned just like the former and is otherwise very similar in its usage.

I would propose the count_ipaddresses-field to be exposed via the REST API for /api/virtualization/interfaces the same as it is now for /api/dcim/interfaces, for both consistency and utility; if that is not indended, then maybe the count_ipaddresses-field should be deprecated on /api/dcim/interfaces so one does not get bitten by assuming it to be there when using both APIs in similar code.

Use case

Consistency in the API between /api/dcim/interfaces and /api/virtualization/interfaces; personally was surprised when the field was unavailable in one but not the other.

There is utility in the count_ipaddresses field in that it can save unnecessary API calls.

Database changes

No response

External dependencies

No response

Originally created by @eikef on GitHub (Mar 30, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v2.10.6 ### Feature type Change to existing functionality ### Proposed functionality Currently the `/api/dcim/interfaces`-endpoint provides a convenient read-only `count_ipaddresses` field in its return, whereas the `/api/virtualization/interfaces`-endpoint does not -- although the latter can have IP addresses assigned just like the former and is otherwise very similar in its usage. I would propose the `count_ipaddresses`-field to be exposed via the REST API for `/api/virtualization/interfaces` the same as it is now for `/api/dcim/interfaces`, for both consistency and utility; if that is not indended, then maybe the `count_ipaddresses`-field should be deprecated on `/api/dcim/interfaces` so one does not get bitten by assuming it to be there when using both APIs in similar code. ### Use case Consistency in the API between `/api/dcim/interfaces` and `/api/virtualization/interfaces`; personally was surprised when the field was unavailable in one but not the other. There is utility in the `count_ipaddresses` field in that it can save unnecessary API calls. ### Database changes _No response_ ### External dependencies _No response_
adam added the type: bugstatus: accepted labels 2025-12-29 19:19:42 +01:00
adam closed this issue 2025-12-29 19:19:42 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4710