examples Protocols
graphql.http
Inline and file-based GraphQL requests, with queries and variables in queries/.
runs as-is
resterm run --all _examples/graphql.httpRun this from the root of a clone of the Resterm repository.
Editor
GraphQL docs### Inline GraphQL Query
# @name GraphQLFetchWorkspace
# @tag graphql workspaces
# @description Inline @graphql request with variables block.
# @graphql
# @operation FetchWorkspace
POST {{graphql.endpoint}}
Accept: application/json
query FetchWorkspace($id: ID!, $includeMembers: Boolean!) {
workspace(id: $id) {
id
name
region
plan
members @include(if: $includeMembers) {
totalCount
edges {
node {
id
email
}
}
}
}
}
# @variables
{
"id": "{{graphql.workspaceId}}",
"includeMembers": true
}
### GraphQL With External Files
# @name GraphQLFromFiles
# @tag graphql files
# @description Loads query and variables via file references.
# @graphql
# @operation FetchWorkspace
# @query < ./queries/workspace.graphql
POST {{graphql.endpoint}}
Accept: application/json
# @variables < ./queries/workspace.variables.jsonquery FetchWorkspace($id: ID!, $includeMembers: Boolean!) {
workspace(id: $id) {
id
name
region
plan
members @include(if: $includeMembers) {
totalCount
edges {
node {
id
email
}
}
}
}
}{
"id": "{{graphql.workspaceId}}",
"includeMembers": false
}