Enable abbreviated API responses e.g. for populating form fields #2044

Closed
opened 2025-12-29 17:21:44 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Oct 4, 2018).

Environment

  • Python version: 3.5.2
  • NetBox version: 2.4.5

Proposed Functionality

Enable abbreviated output when a particular parameter (e.g. ?brief=1) is passed with an API request. For example, GET /api/dcim/devices/ returns a full representation of each device in the list, GET /api/dcim/devices/?brief=1 would return only the integer ID and a text representation of each device.

Use Case

The REST API uses serializers to return NetBox resources as JSON objects. The API output includes all resource attributes, and often includes nested representation of related resources. This can be inefficient when the API output is used for tasks where only a basic representation of each object is required; for example, when populating a <select> widget within an HTML form.

Database Changes

None

External Dependencies

None

Originally created by @jeremystretch on GitHub (Oct 4, 2018). ### Environment * Python version: 3.5.2 * NetBox version: 2.4.5 ### Proposed Functionality Enable abbreviated output when a particular parameter (e.g. `?brief=1`) is passed with an API request. For example, `GET /api/dcim/devices/` returns a full representation of each device in the list, `GET /api/dcim/devices/?brief=1` would return only the integer ID and a text representation of each device. ### Use Case The REST API uses serializers to return NetBox resources as JSON objects. The API output includes all resource attributes, and often includes nested representation of related resources. This can be inefficient when the API output is used for tasks where only a basic representation of each object is required; for example, when populating a `<select>` widget within an HTML form. ### Database Changes None ### External Dependencies None
adam added the status: acceptedtype: feature labels 2025-12-29 17:21:44 +01:00
adam closed this issue 2025-12-29 17:21:44 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2044