Open lunkwill42 opened 6 years ago
Hm. DRF does not have a way of specifying fields.
Two possible solutions:
There are some libraries that have implemented this, for instance https://github.com/wimglenn/djangorestframework-queryfields . This enables the API user to manipulate the fields returned. However this is opt in so that if the user does nothing all fields will be returned.
This is an improvement of the API with no breaking changes.
This involves using HyperlinkedModelSerializer
as a way of displaying identity fields (replacing the id
field with an url
field) and related fields by linking to the api detail endpoint for that object.
This breaks the current flow of the API and thus requires us to increase the API version number. Users of the API that is used to finding serialized netbox data on the interface must now use one more request.
As a sidenote the version number should really be more based on semver than just a single number but that is a separate issue.
When accessing the
/interface
API endpoint using a filter like?netbox=42
, every returned object inlines the details of netbox42
, which seems really redundant.[ ] Is the inlining necessary at all (by necessary, I mean: Does NAV use it?), or can it be disabled by the API client somehow?
[ ] Also to consider: If the inlining were removed in favor of an ID or referencing link - is that a change a breaking API change that would require us to increase the API version number?