Skip to main content
Docs: ApiGear Core

Introduction

ObjectAPI is a specification for defining stateful, object-oriented APIs. Unlike REST or RPC specifications that model stateless request/response interactions, ObjectAPI models interfaces as objects with observable state.

Why Stateful APIs?

Most API specifications (OpenAPI, gRPC/protobuf) are designed for stateless request/response patterns. But many real-world systems have inherent state:

DomainExamples of State
AutomotiveVehicle speed, door lock status, climate settings
Game EnginesPlayer position, inventory, game state
IoT/EmbeddedSensor readings, device configuration
UI ApplicationsForm data, selection state, view models

ObjectAPI models APIs the way programmers naturally think about objects — with properties (state), operations (methods), and signals (events).

┌─────────────────────────────────────────────────────────┐
│ REST / RPC │
│ Client ──request──► Server ──response──► Client │
│ (stateless, request/response only) │
└─────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────┐
│ ObjectAPI │
│ Client ◄──property changes──► Server │
│ ◄──────signals──────── │
│ ───operation calls───► │
│ (stateful, bidirectional) │
└─────────────────────────────────────────────────────────┘

The Three Pillars

ConceptWhat it isAnalogy
PropertiesObservable state that can change over timeClass member variables with change notifications
OperationsMethods you can call (sync or async)Class methods
SignalsServer-initiated events pushed to clientsQt signals, C# events, callbacks

Two Formats, One Specification

ObjectAPI supports two equivalent formats:

A concise, developer-friendly syntax that looks like a programming language:

module org.example 1.0

interface Thermostat {
// Properties (state)
temperature: float // current temperature
targetTemp: float // desired temperature
isHeating: bool // heating active?

// Operations (methods)
setTarget(float temp)
reset()

// Signals (events)
signal overheated(float temp)
}

YAML Format (canonical)

The same API in YAML — used internally and for programmatic generation:

schema: apigear.module/1.0
name: org.example
version: "1.0"

interfaces:
- name: Thermostat
properties:
- { name: temperature, type: float }
- { name: targetTemp, type: float }
- { name: isHeating, type: bool }
operations:
- name: setTarget
params:
- { name: temp, type: float }
- name: reset
signals:
- name: overheated
params:
- { name: temp, type: float }

The IDL format is automatically transformed to YAML by ApiGear tools. Both formats are fully equivalent.

When to Use ObjectAPI

Use ObjectAPI when:

  • Your system has observable state that changes over time
  • Clients need to be notified of state changes (not just poll)
  • You're building interfaces for C++, Qt, Unreal, or embedded systems
  • You want APIs that map naturally to object-oriented code

Consider alternatives when:

  • You're building stateless REST APIs (use OpenAPI)
  • You need high-performance binary serialization only (use protobuf)
  • You're documenting HTTP endpoints (use OpenAPI)

Specification Details

Version 0.2.0

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Definitions

TermDefinition
SystemA collection of modules describing a coherent set of APIs
ModuleA namespaced collection of interfaces, structures, and enumerations (one per file)
InterfaceA named object with properties, operations, and signals
PropertyObservable state on an interface that can change and notify observers
OperationA method that can be called on an interface
SignalAn event emitted by the server to notify clients
StructureA data type with fields (no operations or signals)
EnumerationA set of named integer values