Skip to main content
GraphQL companion to request. variables accepts an object or a JSON-encoded string.

Parameters

ParameterTypeRequiredDescription
urlstringYesGraphQL endpoint URL.
querystringYesGraphQL document.
variablesunknownNoGraphQL variables map.
headersRecord<string, string>NoRequest headers.
timeoutnumberNoMaximum time in milliseconds.
saveAsstringNoName of the variable to write this step’s return value to.
retriesnumberNoNumber of times to retry the step on failure before failing the test.
skippedbooleanNoSkip this step at execution time.

Examples

- graphqlRequest:
    url: https://rickandmortyapi.com/graphql
    query: |-
      query Query {
        characters(page: 2, filter: { name: "Morty" }) {
          info {
            count
          }
          results {
            name
          }
        }
        location(id: 1) {
          id
        }
      }
    saveAs: CHARACTERS
- graphqlRequest:
    url: https://rickandmortyapi.com/graphql
    query: "query User($id: ID!) { user(id: $id) { name } }"
    variables:
      id: user-1
    headers:
      x-trace-id: "{{ env.TRACE_ID }}"
    saveAs: USER