Request
Make a GraphQL API request.
type: "io.kestra.plugin.graphql.Request"
Examples
Make a GraphQL query with variables
id: graphql_request
namespace: company.team
tasks:
- id: graphql_query
type: io.kestra.plugin.graphql.Request
uri: https://example.com/graphql
query: |
query GetUser($userId: ID!) {
user(id: $userId) {
name
email
}
}
variables:
userId: "12345"
Execute a GraphQL query with authentication
id: graphql_with_auth
namespace: company.team
tasks:
- id: get_data
type: io.kestra.plugin.graphql.Request
uri: https://example.com/graphql
headers:
Authorization: "Bearer {{ secret('API_TOKEN') }}"
query: |
query {
viewer {
name
email
}
}
Execute a GraphQL query with operationName
id: graphql_with_operation_name
namespace: company.team
tasks:
- id: get_data
type: io.kestra.plugin.graphql.Request
uri: https://example.com/graphql
query: |
query GetUser {
user(id: "1") {
name
}
}
query GetPosts {
posts {
title
}
}
operationName: "GetUser"
Properties
query *Requiredstring
GraphQL query or mutation to execute.
uri *Requiredstring
The fully-qualified URI that points to the HTTP destination
body string
The full body as a string
contentType string
application/json
The request content type
encryptBody booleanstring
false
If true, the GraphQL response body will be automatically encrypted and decrypted in the outputs.
If this property is set to true
, this task will output the request body using the encryptedBody
output property; otherwise, the request body will be stored in the body
output property.
failOnGraphQLErrors booleanstring
false
Fail task on GraphQL errors
If true, the task will fail when GraphQL returns errors in the response.
formData object
The form data to be send
headers object
The headers to pass to the request
method string
POST
The HTTP method to use
operationName string
Operation name for the GraphQL query
Used when multiple operations are defined in the query document.
options Non-dynamicHttpConfiguration
{
"followRedirects": "true",
"allowFailed": "false",
"defaultCharset": "UTF-8"
}
The HTTP request options
variables object
Variables used in the query.
GraphQL variables can be complex objects with nested structures.
Outputs
body object
The GraphQL data field from the response.
Contains the data returned by the GraphQL server. If the encryptBody
property is set to true
, this will be null and the data will be in encryptedBody
.
code integer
The status code of the response.
encryptedBody string
The encrypted body of the response.
If the encryptBody
property is set to true
, this will contain the encrypted response.
error object
The GraphQL errors from the response.
Contains any errors returned by the GraphQL server.
headers object
The headers of the response.
uri string
uri
The URL of the current request.
Definitions
io.kestra.core.http.client.configurations.TimeoutConfiguration
connectTimeout string
duration
The time allowed to establish a connection to the server before failing.
readIdleTimeout string
PT5M
duration
The time allowed for a read connection to remain idle before closing it.
io.kestra.core.http.client.configurations.BasicAuthConfiguration
type *Requiredobject
password string
The password for HTTP basic authentication.
username string
The username for HTTP basic authentication.
java.nio.charset.Charset
io.kestra.core.http.client.configurations.HttpConfiguration
allowFailed booleanstring
false
If true, allow a failed response code (response code >= 400)
allowedResponseCodes array
List of response code allowed for this request
auth BasicAuthConfigurationBearerAuthConfiguration
The authentification to use.
defaultCharset Charsetstring
UTF-8
The default charset for the request.
followRedirects booleanstring
true
Whether redirects should be followed automatically.
logs array
REQUEST_HEADERS
REQUEST_BODY
RESPONSE_HEADERS
RESPONSE_BODY
The enabled log.
proxy ProxyConfiguration
The proxy configuration.
ssl SslOptions
The SSL request options
timeout TimeoutConfiguration
The timeout configuration.
io.kestra.core.http.client.configurations.ProxyConfiguration
address string
The address of the proxy server.
password string
The password for proxy authentication.
port integerstring
The port of the proxy server.
type string
DIRECT
DIRECT
HTTP
SOCKS
The type of proxy to use.
username string
The username for proxy authentication.
io.kestra.core.http.client.configurations.SslOptions
insecureTrustAllCertificates booleanstring
Whether to disable checking of the remote SSL certificate.
Only applies if no trust store is configured. Note: This makes the SSL connection insecure and should only be used for testing. If you are using a self-signed certificate, set up a trust store instead.
io.kestra.core.http.client.configurations.BearerAuthConfiguration
type *Requiredobject
token string
The token for bearer token authentication.