GraphQL
Request
typescriptCopied1import airplane from "airplane";23export default airplane.task(4{5slug: "get_user_profiles",6// Attach graphql resource to task7resources: ["profile_api"],8},9async (params) => {10const run = await airplane.graphql.request<{ { userId: string; avatar: string } }>(11// The slug of the GraphQL resource to query12"profile_api",13// The operation to execute14`query {15users {16id17name1819}20}`21);22return run.output.data;23}24);
Slug of GraphQL resource to use. See Resources.
The GraphQL query or mutation to execute.
Optional GraphQL variables.
Optional object containing request headers.
Optional object containing URL parameters.
True to retry the request on 500, 502, 503, and 504 error codes. Requests will always be retried on 408 and 429 error codes.
The return value from the GraphQL call.
Any errors returned from the GraphQL server.
pythonCopied1import airplane234@airplane.task(5resources=[6# Attach graphql resource to task7airplane.Resource("profile_api"),8]9)10def get_user_profiles():11run = airplane.graphql.request(12# The slug of the GraphQL resource to query13graphql_resource="profile_api",14# The operation to execute15operation="""16query {17users {18id19name2021}22}23""",24)25return run.output["data"]
Slug of GraphQL resource to use. See Resources.
The GraphQL query or mutation to execute.
Optional GraphQL variables.
Optional object containing request headers.
Optional object containing URL parameters.
True to retry the request on 500, 502, 503, and 504 error codes. Requests will always be retried on 408 and 429 error codes.
The return value from the GraphQL call.
Any errors returned from the GraphQL server.
If the request builtin cannot be executed properly.
If the run fails or is cancelled.