netbox icon indicating copy to clipboard operation
netbox copied to clipboard

Allow sharing GraphQL queries as links

Open mraerino opened this issue 6 months ago • 2 comments

NetBox version

v.4.3.1

Feature type

Change to existing functionality

Proposed functionality

It should be possible to construct links that go to /graphql/ and prefill the query (and maybe variables) in the GraphiQL UI with a certain value contained in the URL.

Usually in GraphiQL, this works by using the ?query= URL parameter, but since that's used to send a GraphQL query via GET, it cannot be used when still wanting to show the GraphiQL interface. Therefore I propose to use #query= in the URL which has the advantage to also not be sent to the server and not polluting access logs.

Use case

This is for cases where i have complex queries i want to share with my collegues in a convenient way

Database changes

No response

External dependencies

No response

mraerino avatar Jun 01 '25 13:06 mraerino

I'm willing to implement this myself.

mraerino avatar Jun 01 '25 13:06 mraerino

Thanks @mraerino , assigned to you.

FWIW, I ran across this GH discussion that has a couple of helpful suggestions while verifying this wasn't already possible.

jnovinger avatar Jun 03 '25 15:06 jnovinger

@mraerino any luck with this?

jeremystretch avatar Jul 03 '25 15:07 jeremystretch

Hey, sorry for the delay here. Life got in the way.

PR is now up: https://github.com/netbox-community/netbox/pull/20014

mraerino avatar Aug 03 '25 12:08 mraerino