Error: A query attribute must be specified and must be a string. What am I doing wrong?

when i use github api v4 with curl in linux,  error meesages as follows:

curl -X POST -H "Authorization: token 7d93b8f3e7********7decfca090d8c3" -d '{"mutation":"mutation {addReaction(input:{subjectId:\"MDU6SXNzd*********yMjE=\"},content:HOORAY){reaction{content},subject{id}}}"}' https://api.github.com/graphql

{“errors”:[{“message”:“A query attribute must be specified and must be a string.”}]}.

I verify my token and subjectId in https://developer.github.com/v4/explorer/  ,it’s ok.

pls tell me what’s wrong with me .thanks

1 Like

I solved this problem.

I use the “query” reply the first “mutation”

1 Like

@guqinling can you post your solution.

1 Like

In other words use:

  • -d {“query” : "mutation {…

instead of 

  • -d { “mutation” : "mutation {

I was banging my head on the wall too…

1 Like