Graphqurl

From wikinotes

graphqurl is a cli graphql query tool with autocompletion.
It is built overtop of curl.

Documentation

github https://github.com/hasura/graphqurl

Install

npm install -g graphqurl

Usage

Interactive

Interactive has tab completion, but without multiline support not very useful yet.

# no auth
gq https://domain.com/graphql

# with auth
gq https://api.github.com/graphql \
  -H "Authorizaton: bearer ${TOKEN}" \

# now type your query
{ __schema { types { name } } }

# hit 'Ctrl+q' to execute query

Non Interactive

# inline query
gq https://domain.com/graphql -q '{ __schema { types { name } } }'

# query from file
gq https://domain.com/graphql --queryfile=in.graphql

# graphiql
gq https://domain.com/graphql -i

Consider piping to bat

gq https://domain.com/graphql -q '{ __schema { types { name } } }' \
    | bat -l graphql --color=always \
    | less -Ri