GraphQL¶
nbx graphql is the CLI entry point for NetBox's GraphQL API. Use it when you
need cross-resource queries or want to prototype GraphQL payloads without
writing Python code.
Basic query¶
Variables¶
Pass one JSON object:
Or repeat -v / --variables with key=value pairs:
Output formats¶
--json and --yaml mirror the output controls available on nbx call and
dynamic commands.
When to use GraphQL vs REST¶
- Use
nbx graphqlwhen you want a single query spanning multiple resource types. - Use dynamic REST commands like
nbx dcim devices listwhen you want schema-driven discovery and the standard NetBox REST workflow. - Use
nbx callwhen you need explicit control over a REST path that is not represented by the dynamic command tree.