-
How can I filter devices by location name (either location.name or location.slug)? Furthermore, how can I find out all the available filter fields? I tried
Here's an example of one device: "location": {
"id": 5,
"url": "http://10.128.36.29/api/dcim/locations/5/",
"display": "CT Sound Lab",
"name": "CT Sound Lab",
"slug": "ct-sound-lab",
"_depth": 0
}, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The available filters are included in the machine-generated REST API documentation, linked from the bottom of your Netbox home page or at https://demo.netbox.dev/api/schema/swagger-ui/ Under This shows that filtering on You'll need to do a separate REST query to find the id of the location you're interested in. Or possibly graphQL can do it directly, I don't know. |
Beta Was this translation helpful? Give feedback.
The available filters are included in the machine-generated REST API documentation, linked from the bottom of your Netbox home page or at https://demo.netbox.dev/api/schema/swagger-ui/
Under
GET /api/dcim/devices/
:This shows that filtering on
location_id
is the only one available (__n
is the negative variation)You'll need to do a separate REST query to find the id of the location you're interested in. Or possibly graphQL can do it directly, I don't know.