Protocol simulator

HTTP Simulator

Use SPX to simulate HTTP REST endpoints with deterministic responses, dynamic payloads, and controllable latency for API integration testing.

Why HTTP simulation matters

Modern IoT, building automation, and industrial systems expose REST endpoints for data access, configuration, and webhooks. Testing HTTP integrations against real backend services is slow, brittle, and often blocked by infrastructure dependencies. Teams need deterministic, controllable HTTP endpoints to validate client logic, webhook handling, and API contracts before connecting to production services.

SPX solves this by exposing HTTP REST endpoints backed by twin attributes. Teams can simulate weather feeds, air quality stations, vision systems, and custom REST APIs with full control over responses, payloads, and timing.

Integration problem

REST backends are slow, rate-limited, or unavailable for testing

Production HTTP APIs have rate limits, authentication barriers, and variable latency that make deterministic integration testing difficult.
Contract problem

API responses and webhook payloads need validation

Clients expect predictable JSON responses, status codes, and payload structures that match real service behavior.
Observability problem

HTTP exchanges are hard to debug against external services

When an integration fails against a production API, reproduction requires the same data state and network conditions, which is rarely possible.
SPX approach

Expose deterministic HTTP endpoints from twin attributes

SPX provides HTTP REST endpoints backed by twin state, giving teams full control over responses, payloads, latency, and error conditions.

What SPX simulates

SPX includes an HTTP endpoint adapter (http_endpoint) that exposes deterministic REST endpoints backed by attributes. Endpoints are served by FastAPI/uvicorn inside SPX Server and support GET, POST, PUT, and DELETE methods with JSON payloads.

REST endpoints

GET, POST, PUT, and DELETE with JSON payloads

Define HTTP endpoints with path parameters, query parameters, and request body parsing that map to twin attributes and custom responses.
Realistic data

Weather feeds, air quality, and telemetry APIs

Simulate realistic data feeds with dynamic values that change over time, just like real IoT and environment services.
Runtime control

Change response data and latency at runtime

Modify attribute values behind HTTP endpoints, inject response delays, and test client timeout handling while the twin is running.
Scenarios

Reproducible error and edge-case scenarios

Script 404 responses, malformed payloads, slow responses, and rate-limit behavior as repeatable test cases.

Core capabilities

HTTP simulation in SPX is built for API integration testing, webhook validation, and service-mock workflows.

Endpoint mapping

Map HTTP routes to twin attributes

Define endpoints with path templates, bind request parameters to attributes, and build custom JSON responses from twin state.
Runtime control

Steer response data and timing

Change telemetry values, inject response delays and jitter, and control error conditions while HTTP clients are connected.
CI/CD

Run HTTP mock tests in Docker and CI

HTTP twins run in containers, so integration tests can exercise client logic without external API dependencies.
Observability

Inspect HTTP requests and responses in real time

See incoming requests, response payloads, status codes, and attribute changes from one runtime view.

Example models

SPX ships with HTTP endpoint models for weather feeds, air quality stations, and vision systems.

Developer path

HTTP simulation connects directly to the model catalog, industry packs, and developer workflows.

Next step

Test HTTP integrations without external API dependencies

Run HTTP endpoint twins locally, validate REST contracts and webhook handling, and automate integration tests in CI.