Filter by Tags with dcim.devices.filter not working? #18792
-
When using nb.dcim.devices.filter() to try to filter the device list from the API, it seems like trying to filter by tags doesn't work. The pull will work without the tag, though I'd like to see what devices match a tag. Ideally, I'd like to be able to exclude devices that match a defined tag. Example: That 'tags="env: lab"' seems to have no effect on what's returned. When I use "tag" instead of "tags," I get this error: Is it even possible to filter based on tags? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Great question! In NetBox, tags function more like labels rather than key-value pairs, so filtering by Hope that helps! |
Beta Was this translation helpful? Give feedback.
Great question! In NetBox, tags function more like labels rather than key-value pairs, so filtering by
"env: lab"
as a direct value won’t work. Instead, you’ll need to filter using the tag’s slug. You can find more details on how tags work in the NetBox documentation here: NetBox Tags.Hope that helps!