GraphQL quick tip: How to pass variables in GraphiQL

David Mráz
Atheros
Published in
2 min readAug 27, 2017

--

This article is also available at https://atheros.ai/blog/graphql-quick-tip-how-to-pass-variables-in-graphiql without the paywall.

Introduction

In the previous article input object type as an argument for GraphQL mutations, we used GraphiQL for executing queries and mutations. We mentioned the following different forms of passing an argument into a mutation

  • Using inline arguments
  • Using variables

Now let’s discuss how we can perform query executions using inline arguments and variables in GraphiQL as we did not mention that in previous articles. First, just clone this repository and switch to the corresponding branch to test our example mutation

git clone git@github.com:atherosai/graphql-gateway-apollo-express.git

The process of designing mutations is described in the article on GraphQL mutations. We will use the same example of a mutation, nevertheless, in this quick blog post, we will focus only on our options for executing mutations and queries in GraphiQL.

Inline arguments in GraphiQL

First we can use inline arguments. The mutation execution string is then written as follows and there are no other requirements for executing…

--

--

David Mráz
Atheros

Founder of https://atheros.ai | Artificial Intelligence | Machine Learning | JavaScript, Python, C++ | Business