graphqurl icon indicating copy to clipboard operation
graphqurl copied to clipboard

How to use gq with mutation and json input file

Open kad-meedel opened this issue 4 years ago • 1 comments

Hello, I found the gq very usefull, but I'm stil looking for the right syntax how to implement a gq with a mutation and a json input file for the variables.

mutation looks like this:

queryFile:

mutation createRepository($input: CreateRepositoryInput!) { createRepository(input: $input) { clientMutationId } }

variableFile:

{ "input": {
"name" : "create-testrepo", "visibility": "INTERNAL", "description": "create test repository", "ownerId": "xxxxxxxxxxxxxxxxxxxxx", "teamId": "xxxxxxxxxxxxxxxxxx", "hasIssuesEnabled": false, "hasWikiEnabled": false } }

When I use this on the command line I get an error.

gq https://api.github.com/graphql -H "authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxx" -H "content-type: application/json" --variableFile='./repodata' --queryFile='./query.gql

» Error: cannot parse header '--variableFile='./repodata'' (multiple ':')

Please advice how to use.

kad-meedel avatar Dec 18 '19 08:12 kad-meedel

Need to use double quotes instead of single

variableFile='./repodata' should be variableFile="./repodata"

Motoxpro avatar Jul 07 '21 04:07 Motoxpro