-
I am trying to query sites using the netbox GraphQL interface by matching on tags. works does not give any results (would expect multiple sites some with mytag1 and others with mytag2 Similar query does seem to work for other fields. Any idea how i can accomplish this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I would expect it to return only those sites which have both mytag1 and mytag2. This is how queries via the REST API work at least, as documented here: https://docs.netbox.dev/en/stable/reference/filtering/#filtering-objects a logical AND operation will be used in instances where a field may have multiple values, such as tags. For example, (and I believe the filtering logic is common between REST and graphql). See also discussion #11703 |
Beta Was this translation helpful? Give feedback.
I would expect it to return only those sites which have both mytag1 and mytag2. This is how queries via the REST API work at least, as documented here:
https://docs.netbox.dev/en/stable/reference/filtering/#filtering-objects
a logical AND operation will be used in instances where a field may have multiple values, such as tags. For example,
GET /api/dcim/sites/?tag=foo&tag=bar
will return only sites which have both the "foo" and "bar" tags applied.(and I believe the filtering logic is common between REST and graphql).
See also discussion #11703