mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-15 20:18:17 -06:00
Apply suggestions from code review
This commit is contained in:
parent
f3ced9ab83
commit
52cab5691e
@ -85,16 +85,16 @@ Each model generally has two views associated with it: a list view and a detail
|
|||||||
* `/api/dcim/devices/` - List existing devices or create a new device
|
* `/api/dcim/devices/` - List existing devices or create a new device
|
||||||
* `/api/dcim/devices/123/` - Retrieve, update, or delete the device with ID 123
|
* `/api/dcim/devices/123/` - Retrieve, update, or delete the device with ID 123
|
||||||
|
|
||||||
Lists of objects can be filtered or ordered using a set of query parameters. For example, to find all interfaces belonging to the device with ID 123:
|
Lists of objects can be filtered and ordered using a set of query parameters. For example, to find all interfaces belonging to the device with ID 123:
|
||||||
|
|
||||||
```
|
```
|
||||||
GET /api/dcim/interfaces/?device_id=123
|
GET /api/dcim/interfaces/?device_id=123
|
||||||
```
|
```
|
||||||
|
|
||||||
An optional `ordering` parameter can be used to define how to sort the results. Building off the previous example, to sort all the interfaces in reverse order of creation (newest to oldest) for a device with ID 123:
|
An optional `ordering` parameter can be used to define how to sort the results. Building off the previous example, to sort all the interfaces in reverse order of creation (newest to oldest) for a device with ID 123:
|
||||||
|
|
||||||
```
|
```
|
||||||
GET /api/dcim/devices/?device_id=123&ordering=-creation
|
GET /api/dcim/interfaces/?device_id=123&ordering=-created
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [filtering documentation](../reference/filtering.md) for more details on topics related to filtering, ordering and lookup expressions.
|
See the [filtering documentation](../reference/filtering.md) for more details on topics related to filtering, ordering and lookup expressions.
|
||||||
|
Loading…
Reference in New Issue
Block a user