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
Querying Issues
Making Mutations
Mutations modify data on the server. All mutations follow a consistent pattern with result types that includecorrelationId and errors.
Creating an Asset Filter
Pagination
The API uses Relay-style cursor-based pagination:Error Handling
Query Errors
GraphQL returns errors in theerrors 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:- Authentication - Learn about auth methods and credential management
- Common Patterns - Deep dive into pagination, filtering, and GeoJSON
- Domain Guides - Explore specific use cases:
- Assets - Asset management
- Field Service Management - Issues, workflows, and mobile tasks
- Emissions - LDAR operations
- Core Platform - Authentication, users, and platform services
- Subgraph Reference - Complete schema documentation:
Interactive Exploration
Apollo Explorer (Recommended)
SensorUp includes Apollo Explorer as a built-in plugin for interactive query building and schema exploration: Demo Environment:- 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
- Replace
customer-demo.sensorup.comwith 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