Get switch interfaces description by switch name with graphql #19662
Replies: 2 comments
-
Hi, For using filters, I'd recommend building your query with the GraphQL Explorer, which you can find in the left-hand navigation bar of the NetBox GraphQL UI. It’s really useful for understanding the expected input structure. That said, here’s a working query that filters by device name: query MyQuery {
device_list(filters: {name: {exact: "dmi01-akron-sw01"}}) {
id
interfaces {
name
description
}
}
} Hope this helps! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks a lot @pheus that's exactly what I needed, I couldn't see the Graphql Explorer, much easier this way. Regards |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have been trying to use graphql to get the interface names for a switch (I am trying to create a small script to update the descriptions based on field information)
I achieved this query that obtains the interfaces names
But I would like to avoid having to know the ID (it mostly defeats the idea of using grahpql) to get the results
I was trying to get a filter so select the device by name and got this:
But unfortunately it doesn't work and I am lost, this is the output:
Any ideas appreciated, thanks
Beta Was this translation helpful? Give feedback.
All reactions