Skip to content

Instantly share code, notes, and snippets.

@bschulz87
Forked from dabit3/testing-graphql.sh
Created February 4, 2025 14:21
Show Gist options
  • Select an option

  • Save bschulz87/113cfc6caf62be12530b6de731e9a767 to your computer and use it in GitHub Desktop.

Select an option

Save bschulz87/113cfc6caf62be12530b6de731e9a767 to your computer and use it in GitHub Desktop.
GraphQL requests using CURL
# query
curl \
-X POST \
-H "x-api-key: xxx-xxxx" \
-H "Content-Type: application/json" \
-d '{ "query": "query { listUsers { name } }" }' \
https://app-id.appsync-api.us-east-1.amazonaws.com/graphql
# mutation with variables
curl \
-X POST \
-H "x-api-key: xxx-xxxx" \
-H "Content-Type: application/json" \
-d '{ "query": "mutation($user: UserInput!) { createUser(user: $user) { name location id } }" ,
"variables": {
"user": {
"name": "Nader Dabit",
"location": "United States",
"id": "001"
}
}
}' \
https://app-id.appsync-api.us-east-1.amazonaws.com/graphql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment