Using curl and GraphQL
2017-06-24
POST a mutation to login. We can put that GraphQL query in the body. We will receive a token and a user object.
curl
-H "Content-Type:application/json"
-d '{
"query":
"mutation {
login(email:\"admin@admin.com\",password:\"password\") {
token,
user {
id
,createdAt
,updatedAt
}
}
}"
,"variables":null
}'
-X POST 'http://localhost:4000/graphql'
GET an unauthenticated GraphQL query. This requires the -g
flag in order to allow curly brackets {}
in the URL.
GET an authenticated GraphQL query. The required headers may vary depending on the application.