public-roadmap icon indicating copy to clipboard operation
public-roadmap copied to clipboard

Support GraphQL Variables

Open hiroingk opened this issue 4 years ago • 5 comments

Is your feature request related to a problem? Please describe. We're building a GraphQL Endpoint. Checkly allows using GraphQL Queries in API Tests. https://www.checklyhq.com/docs/api-checks/request-settings/ But in Checkly's UI, can't using GraphQL Variables.

Describe the solution you'd like Add a form to write GraphQL Variables.

Describe alternatives you've considered Using JSON body type as a workaround. But, this is painful for me.

hiroingk avatar Jul 21 '20 09:07 hiroingk

@hiroingk thanks for contributing. Would you be able to give a concrete example of one of your GraphQL queries with the variables?

tnolet avatar Jul 22 '20 21:07 tnolet

Hi @tnolet. Currently, this is the part we'd put in checkly's API body if the type is set to graphql

query GetTournament($id: UUID!, $previewMode: Boolean) {
  publishedTournament(id: $id, previewMode: $previewMode) {
    id
    __typename
  }
}

But we need to supply the following variables for that to be a valid query

{
  "id": "f02743d7-de5c-4dd2-8ce0-09f76142902e",
  "previewMode": false
}

Full body of request sent over the wire by graphql playground looks like this:

{
  "operationName": "GetTournament",
  "variables": {
    "id": "f02743d7-de5c-4dd2-8ce0-09f76142902e",
    "previewMode": false
  },
  "query": "query GetTournament($id: UUID!, $previewMode: Boolean) {\n  publishedTournament(id: $id, previewMode: $previewMode) {\n    id\n    __typename\n  }\n}\n"
}

peter-dolkens avatar Oct 27 '21 20:10 peter-dolkens

any updates on this? currently we cannot use named query which takes variables.

adikari avatar Oct 24 '22 11:10 adikari

Hey @adikari no updates right now. One question: are you using some other tool / platform right now to solve this problem for you (Postman, Insomnia or another monitoring platform?)

tnolet avatar Oct 31 '22 12:10 tnolet

I was using postman and now moving to checkly. The checks in checkly use fine but without variable support I can't use named queries Nd it messes up my reporting. Checkly is hitting my endpoint every 5 mins and without named query my report is filled with queries without names.

adikari avatar Oct 31 '22 20:10 adikari