postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.86k stars 840 forks source link

Allow custom query and variables field names in GraphQL #12111

Open ryanhughes-motional opened 1 year ago

ryanhughes-motional commented 1 year ago

Is there an existing request for this feature?

Is your feature request related to a problem?

I'm trying to make a GraphQL request to a GraphQL API.

Most GraphQL APIs take in a JSON body with two params: “query” and “variables”. In other words, Postman (when using GraphQL) will send out a body like this: { “query”: … “variables”: … }

However, I am working with a GraphQL endpoint that takes “query_str” and “variables”. Like this: { “query_str”: … “variables”: … }

I don't see a way to tell postman to put the GraphQL Query in "query_str" instead of "query".

Describe the solution you'd like

A feature to specify which the field name the query should be in would be great.

Describe alternatives you've considered

I'm reaching out to the people make the API as well.

Additional context

No response

codenirvana commented 1 year ago

I will suggest using the raw mode body in HTTP for this specific use case like this:

image

@ryanhughes-motional For HTTP transport, GraphQL follows https://graphql.org/learn/serving-over-http/#post-request. I am curious to know why you would like the API to behave like this. 🤔

ryanhughes-motional commented 1 year ago

I didn't build the API - I am using an API someone else built :)