Skip to main content

Introduction

The GraphQL API is a powerful way to access your data. GraphQL is query language that enables your applications to ask for specific fields on a filtered set of objects. It returns only the data that is requested with minimal overhead. For example, the query below returns all machines that currently experience downtime with their execution state, the alarm state

query ExampleQuery {
machines(where: {annotations: {endAt: {_is_null: true }}}) {
name
currentAlarms {
startAt
nativeCode
label
description
}
currentStates(where: {metricKey: {_eq: "MasterExecution"}}) {
metricKey
value
}
annotations(where: {endAt: {_is_null: true }}) {
annotationType {
name
}
startAt
}
}
}

Schema

The GraphQL schema describes and defines the set of objects, fields, relationships, types, enum values, etc. that a client can access via the API. Calls from the client are validated against the schema. The schema itself is queriable data that can be accessed through the API. This process is called introspection. GraphQL query tools and libraries can introspect the schema and generate documentation, provide code-completion, perform syntax-checks, etc..