request. variables accepts an object or a JSON-encoded
string.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | GraphQL endpoint URL. |
query | string | Yes | GraphQL document. |
variables | unknown | No | GraphQL variables map. |
headers | Record<string, string> | No | Request headers. |
timeout | number | No | Maximum time in milliseconds. |
saveAs | string | No | Name of the variable to write this step’s return value to. |
retries | number | No | Number of times to retry the step on failure before failing the test. |
skipped | boolean | No | Skip 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