Allow sharing GraphQL queries as links #11245

Closed
opened 2025-12-29 21:42:24 +01:00 by adam · 4 comments
Owner

Originally created by @mraerino on GitHub (Jun 1, 2025).

Originally assigned to: @mraerino on GitHub.

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

Originally created by @mraerino on GitHub (Jun 1, 2025). Originally assigned to: @mraerino on GitHub. ### 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_
adam added the status: acceptedtype: featurecomplexity: low labels 2025-12-29 21:42:24 +01:00
adam closed this issue 2025-12-29 21:42:25 +01:00
Author
Owner

@mraerino commented on GitHub (Jun 1, 2025):

I'm willing to implement this myself.

@mraerino commented on GitHub (Jun 1, 2025): I'm willing to implement this myself.
Author
Owner

@jnovinger commented on GitHub (Jun 3, 2025):

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 commented on GitHub (Jun 3, 2025): Thanks @mraerino , assigned to you. FWIW, I ran across this [GH discussion](https://github.com/graphql/graphiql/discussions/3450) that has a couple of helpful suggestions while verifying this wasn't already possible.
Author
Owner

@jeremystretch commented on GitHub (Jul 3, 2025):

@mraerino any luck with this?

@jeremystretch commented on GitHub (Jul 3, 2025): @mraerino any luck with this?
Author
Owner

@mraerino commented on GitHub (Aug 3, 2025):

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

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

@mraerino commented on GitHub (Aug 3, 2025): Hey, sorry for the delay here. Life got in the way. PR is now up: https://github.com/netbox-community/netbox/pull/20014
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11245