Skip to main content

GraphQL API Quickstart

This guide will help you make your first GraphQL query to the SensorUp API and understand the basics of working with the federated graph.

Prerequisites

Before you begin, you’ll need:
  • Access to a SensorUp environment (demo, staging, or production)
  • Valid authentication credentials (see Authentication)
  • A GraphQL client or HTTP tool (curl, Postman, or a programming language client)

Your First Query

Using curl

Response

Understanding the Query Structure

GraphQL queries have three main components:

Common Query Patterns

Querying Asset Profiles

Getting Specific Asset by ID

Variables:

Querying Issues

Making Mutations

Mutations modify data on the server. All mutations follow a consistent pattern with result types that include correlationId and errors.

Creating an Asset Filter

Variables:

Pagination

The API uses Relay-style cursor-based pagination:
First page:
Next page:

Error Handling

Query Errors

GraphQL returns errors in the errors array:

Mutation Errors

Mutations return errors in the result type:

Using GraphQL Clients

JavaScript/TypeScript

Python

Next Steps

Now that you’ve made your first queries:
  1. Authentication - Learn about auth methods and credential management
  2. Common Patterns - Deep dive into pagination, filtering, and GeoJSON
  3. Domain Guides - Explore specific use cases:
  4. Subgraph Reference - Complete schema documentation:
    • Assets - Asset profiles for field service
    • CAM Assets - Connected asset management
    • Issues - Issue tracking
    • Forms - XForms data collection
    • Auth - Authentication and sessions
    • Workflow - Workflow definitions
    • And more in the subgraphs directory

Interactive Exploration

SensorUp includes Apollo Explorer as a built-in plugin for interactive query building and schema exploration: Demo Environment:
Features:
  • Interactive query builder with autocomplete
  • Full schema documentation browser
  • Query history and saved queries
  • Authentication handled automatically (no need to manually set headers)
  • Real-time query validation
For other environments:
  • Replace customer-demo.sensorup.com with your environment’s hostname
  • The plugin path remains /plugins/sr/apolloGraphql

Additional Resources

For further exploration tools, contact your SensorUp account team about:
  • Apollo Studio access for advanced query planning and performance monitoring
  • Postman collections with example queries