ION DocsV3
  • Architecture
    • ION Architecture V2
      • ION V2 — Architecture Overview
      • V2 context
        • V2 capacity model
        • V2 constraints
        • V2 integration boundaries
        • V2 requirements
        • V2 solution strategy
      • V2 Structural Design
        • ION V2 Landscape
        • ION V2 Platform Views
          • ION V2 Delivery and Runway
          • ION V2 Incident-Processing Pipelines
          • ION V2 Platform Networking
          • ION V2 Platform Observability
          • ION V2 Platform Security
        • ION V2 System Context
        • ION V2 Systems
          • Alya System Topology
          • Cogs System Topology
          • Ion IQ System Topology
          • Kingsman System Topology
          • Pigeon System Topology
          • Veritas System Topology
          • Watchtower System Topology
      • V2 evolution and platform lineage
        • Tiberium Origins
          • Tiberium Architecture Overview
          • Tiberium Components Architecture Overview
        • Voyager and the V2 Merge
          • Voyager Architecture Overview
          • Voyager Identity Architecture Overview
          • Voyager Services Architecture Overview
      • V2 Platform Architecture
        • Alya Workbench
          • Mission Brief: Alya (Workbench for Cyber Defenders)
        • Asset Discovery
        • Automation
        • Customer Communications
          • Notification and Escalation Design
        • Reporting and Dashboards
        • Vulnerability Mitigations
      • V2 Well-Architected
        • V2 Reliability
          • Availability Architecture
        • V2 Security
          • API Management
            • API Management Architecture
            • API Management Guidelines
            • API Management Implementation
              • APIM Deployment and Debugging
              • APIM Global Policy Implementation
              • APIM Platform Provisioning
              • APIM Policy Authoring
              • APIM Service Onboarding
              • APIM Webhook Flow Implementation
            • API Management Policy Model
          • V2 Security Architecture
          • Teams Notification Security
          • Customer Data and PII
          • V2 Identity
            • Applications and Authorization
            • V2 Identity Architecture
            • Microsoft Entra ID
            • V2 Identity Standard
            • V2 Identity Implementation
              • Application Registration
              • Application Roles
              • Customer Identity Onboarding
              • Identity Lifecycle and Operations
              • Managed Identity
            • V2 Identity Workflows
              • Alya Workbench Identity Workflow
              • Customer Portal Identity Workflow
              • Microservices Identity Workflow
              • ServiceNow Inbound Identity Workflow
              • Microsoft Teams Identity Workflow
          • Customer Environment Access
            • Customer Environment Access Architecture
            • Customer Environment Access Guidelines
            • Customer Environment Access How-to
    • ION Architecture V3
      • ION V3 Architecture Overview
      • V3 context
        • V3 capacity model
        • V3 constraints
        • V3 integration boundaries
        • V3 requirements
        • V3 solution strategy
      • V3 Structural Design
        • Data and events
          • Archival and retention
          • Event model
          • Event sourcing
          • Event store
          • Micro-frontend interaction
          • Recovery and disaster recovery
          • Replay and reconstruction
          • Reporting and customer analytics
          • Event-sourcing requirements
          • Snapshots
          • UI interaction
        • ION v3 domains
          • Assets domain
            • Assets domain flows
            • Assets domain implementation
            • Assets domain model
          • Customer Collaboration domain
            • Customer Collaboration domain flows
            • Customer Collaboration domain implementation
            • Customer Collaboration domain model
          • Incident domain
            • Incident domain flows
            • Incident domain implementation
            • Incident domain model
          • Investigation domain
            • Investigation domain flows
            • Investigation domain implementation
            • Investigation domain model
          • Remediation domain
            • Remediation domain implementation
            • Remediation domain model
          • Ticket domain
            • Ticket domain flows
            • Ticket domain implementation
            • Ticket domain model
        • ION V3 Landscape
        • ION V3 Platform Views
          • Internal API
            • Internal API architecture
            • Internal API consumer guide
            • Internal API identity and access
            • Internal API implementation
          • Micro-Frontends
            • Micro-Frontends architecture
            • Micro-Frontends capability service (Signet)
            • Micro-Frontends composition
            • Micro-Frontends identity and access
            • Micro-Frontends implementation
            • Micro-Frontends real-time (SignalR)
            • Micro-Frontends routing and ingress
            • Shells and MFEs
          • SOAR Integration
            • SOAR Integration architecture
            • SOAR Integration customer onboarding
            • SOAR Integration Identity and Access Design
            • SOAR Integration implementation
            • SOAR Integration operations
        • ION V3 System Context
        • ION V3 systems
          • Alya
          • Cogs
          • ION IQ
          • Kingsman
          • Pigeon
          • Veritas
          • Watchtower
      • V2 to V3 evolution
        • V2 to V3 architecture delta
        • V2 to V3 decision changes
        • V2 to V3 migration guidance
        • V2 to V3 service impact
      • Well-Architected
        • Cost Optimization
          • Cost Governance
            • Cost Governance Architecture
            • Cost Governance Guidelines
            • Cost Governance Implementation
          • SKU Strategy
            • SKU Strategy Architecture
            • SKU Strategy Guidelines
            • SKU Strategy Implementation
        • Operational excellence
          • Audit Logs
            • Audit Logs Architecture
            • Audit Logs Guidelines
            • Audit Logs Implementation
          • CI/CD Runway
            • CI/CD Runway Architecture
            • CI/CD Runway Guidelines
            • CI/CD Runway Implementation
          • Feature Flags
            • Feature Flags Architecture
            • Feature Flags Guidelines
            • Feature Flags Implementation
          • Incident management
            • Incident management architecture
            • Incident management guidelines
            • Incident management implementation
          • Azure Landing Zone
            • Azure Landing Zone Architecture
            • Azure Landing Zone Guidelines
            • Azure Landing Zone Implementation
          • Notifications
            • Notifications Architecture
            • Notifications Guidelines
            • Notifications Implementation
          • Observability
            • Observability Architecture
            • Observability Guidelines
            • Observability Implementation
        • Performance efficiency
          • Capacity, sizing, and scaling
            • Capacity, sizing, and scaling architecture
            • Capacity, sizing, and scaling guidelines
            • Implement capacity, sizing, and scaling
          • UI responsiveness
            • UI responsiveness architecture
            • UI responsiveness guidelines
            • Implement UI responsiveness
        • V3 reliability
          • Application resilience patterns
          • Critical flows
          • Customer reliability assurance
            • ION Platform reliability and service continuity
            • Customer reliability slides
          • Disaster recovery
            • Disaster recovery architecture
            • Disaster recovery guidelines
            • Disaster recovery implementation
              • DR implementation: API Management
              • DR implementation: App Configuration
              • DR implementation: Application Gateway
              • DR implementation: Azure SQL Database
              • DR implementation: Container Apps
              • DR implementation: Container Registry
              • DR implementation: Cosmos DB
              • DR implementation: Event Hubs
              • DR implementation: Azure Front Door
              • DR implementation: Function Apps
              • DR implementation: Key Vault
              • DR implementation: Log Analytics and Application Insights
              • DR implementation: MySQL Flexible Server (Temporal)
              • DR implementation: PostgreSQL Flexible Server
              • DR implementation: Azure Managed Redis
              • DR implementation: Service Bus
              • DR implementation: SignalR
              • DR implementation: Storage accounts
            • Operational-data replication
            • Disaster recovery operations
          • Edge and routing
            • Azure Application Gateway
              • Azure Application Gateway architecture
              • Azure Application Gateway guidelines
              • Azure Application Gateway implementation
              • Azure Application Gateway resiliency
              • Azure Application Gateway security
            • Azure Front Door
              • Azure Front Door architecture
              • Azure Front Door guidelines
              • Azure Front Door implementation
              • Azure Front Door resiliency
              • Azure Front Door security
          • Event-store disaster recovery (moved)
          • Failure mode analysis
          • Graceful degradation
            • Graceful degradation architecture
            • Graceful degradation guidelines
            • Graceful degradation implementation
          • V3 reliability maturity model
            • V3 reliability maturity assessment
            • Maturity level 2: self-preservation
            • Maturity level 3: recovery readiness
            • Maturity level 4: maintain stability
            • Maturity level 5: stay resilient
          • Multi-region replication
            • Multi-region replication architecture
            • Multi-region replication guidelines
            • Multi-region replication implementation assessment
          • Reliability testing
          • Scaling and headroom
          • Targets and health model
          • Trade-offs and accepted risks
        • V3 Security
          • API Management
            • API Management Architecture
            • API Management Guidelines
            • API Management Implementation
              • API Contracts and Asynchronous Operations
              • APIM Deployment and Debugging
              • APIM Global Policy Implementation
              • APIM Platform Provisioning
              • APIM Policy Authoring
              • APIM Service Onboarding
              • APIM Webhook Flow Implementation
            • API Management Policy Model
          • V3 Security Architecture
          • Data protection
            • Data protection architecture
            • Data protection guidelines
            • Data protection implementation guidelines
              • API Management
              • Application Gateway
              • Azure SQL Database
              • Azure Container Apps
              • Azure Cosmos DB
              • Azure Front Door
              • Azure Function Apps
              • Azure Database for MySQL
              • Azure Database for PostgreSQL
              • Data protection procedures
          • V3 Security Guidelines
          • V3 Identity
            • Applications and Authorization in ION V3
            • V3 Identity Architecture
            • Capabilities
            • Microsoft Entra ID for ION V3
            • V3 Identity Standard
            • V3 Identity Implementation
              • App Service Authentication
              • Application Registration
              • Application Roles
              • Customer Azure RBAC
              • Customer Identity Onboarding
              • Identity Lifecycle and Operations
              • Mailbox-Scoped Access
              • Managed Identity
              • Workload Identity Federation
            • V3 Identity Workflows
              • Alya Workbench Identity Workflow
              • Customer Azure RBAC Identity Workflow
              • Customer Portal Identity Workflow
              • Mailbox Access Identity Workflow
              • Microservices Identity Workflow
              • ServiceNow Inbound Identity Workflow
              • Shell and MFE Identity Workflow
              • Microsoft Teams Identity Workflow
          • Customer Environment Access
            • Azure Lighthouse
              • Azure Lighthouse implementation
            • GDAP and Tenant Governance
              • Access Packages (legacy)
              • GDAP human access implementation
            • Customer environment access guidelines
            • Multi-tenant Entra apps
              • Multi-tenant Entra apps implementation
            • Teams B2B Direct Connect
              • Teams B2B Direct Connect implementation
          • Network Security
            • Network Security Architecture
            • Network Security Guidelines
            • Network Security Implementation
              • Egress and Static IPs
              • Resource Access Restrictions
          • V3 Security Patterns
    • ION Architecture V4
      • How V4 evolves from V3
  • Principles
  • Patterns
    • Application Permissions Only
    • Async REST
    • Audit Logs (Pattern)
    • Auth / AuthZ
    • Dead Letter Queue (DLQ)
    • Dual Writes (and how to avoid them)
    • ECST — Event-Carried State Transfer
    • Event Hubs Throttling
    • Feature Flags (Pattern)
    • Idempotent Write
    • MFE UI Interaction
    • Notifications (Pattern)
    • Private Data Store Access
    • Schema Evolution
    • Service Bus Topic Throttling
    • UI Interaction with an Event-Sourced Backend
  • Standards
    • API Standard
    • API Standards
    • Coding Standard
    • Coding Standards
    • Documentation Standard
    • Documentation Standards
    • Microservice Standard
    • Microservice Checklist
    • Operational Readiness Standard
    • ORR — Operational Readiness Review Checklist
  • Decisions
    • ADR-0001
    • ADR-0002
    • ADR-0003
    • ADR-0004
    • ADR-0005
    • ADR-0006
    • ADR-0007
    • ADR-0008
    • ADR-0009
    • ADR-0010
    • ADR-0011
    • ADR-0012
    • ADR-0013
    • ADR-0014
    • ADR-0015
    • ADR-0016
    • ADR-0017
    • ADR-0018
    • ADR-0019
    • ADR-0020
    • ADR-0021
    • ADR-0022
    • ADR-0023
    • ADR-0024
    • ADR-0025
    • ADR-0026
    • ADR-0027
    • ADR-0028
    • ADR-0029
    • ADR-0030
    • ADR-0031
    • ADR-0032
    • ADR-0033
    • ADR-0034
  • Services
  • Governance
    • Assumptions
    • Discrepancies
    • V3 reference coverage and conflict matrix
OntinueION Docs
  1. Decisions
  2. json:api RESTful API spec (cursor pagination, URI-path versioning) and Async REST pattern for the HTTP leg of Trilateral APIs

json:api RESTful API spec (cursor pagination, URI-path versioning) and Async REST pattern for the HTTP leg of Trilateral APIs

proposedoperational excellence
decisionsv2v3v4proposed0020apiresthttpasync-restopenapiapimtrilateral

ADR-0020 — json:api RESTful API spec (cursor pagination, URI-path versioning) and Async REST pattern for the HTTP leg of Trilateral APIs

Context

ADR-0001 locks in the Trilateral API rule (§ 10): every ION service publishes three interfaces — a publish interface, a subscribe interface, and a synchronous request/response API for commands and queries. The publish/subscribe legs are standardized by ADR-0005 (CloudEvents + AsyncAPI over the shared Service Bus per ADR-0008). The synchronous leg is not yet standardized — services need a shared answer to:

  1. What protocol/style for the sync leg? REST, gRPC, GraphQL, RPC, or mixed?
  2. What contract format, versioning discipline, response envelope, error shape, correlation, and rate-limit conventions?
  3. What pattern for long-running requests that don’t finish inside the caller’s timeout budget but don’t warrant a Temporal workflow either (report generation, bulk queries, expensive projections)?
  4. How does this fit with the shared APIM ingress (ADR-0014), which enforces auth, rate limits, and routing platform-wide?

V2 already had informal REST conventions across most services (per Architecture- API Guidelines.md, Architecture- Internal API.md) — this ADR retrospectively codifies them and adds the Async REST 202 + polling pattern from Design Pattern- ASYNC Rest API.md as the sanctioned way to expose long-running operations over HTTP.

Forces / Drivers

  • Requirement / Constraint: Trilateral API rule (§ 10); shared APIM as the sole ION API ingress (ADR-0014); BFF pattern for frontends (ADR-0013, § 13); credential-less service-to-service auth via UAMI + Entra app-roles (§ 12); API-consumer ergonomics for internal tooling teams (Architecture- Internal API.md worked example); some request types (report generation, bulk aggregations) exceed comfortable synchronous latency budgets but do not need durable state or long-lived signals.
  • Principle(s) embodied: § 10 Trilateral API (the HTTP leg); § 12 Managed Identity; § 13 BFF pattern; § 16 Observability at every layer (correlation IDs traverse HTTP + event legs); § 21 Azure-native managed services first (APIM alignment, OpenAPI toolchain in the Azure ecosystem).
  • WAF pillar optimized: operational-excellence (primary — one API style across the platform, one contract format, one error shape, one observability contract); performance-efficiency (async REST unblocks long-running operations without holding HTTP connections open); security (uniform token audience/role model, uniform rate limiting).

Decision

The synchronous leg of the Trilateral API is RESTful HTTP/JSON that conforms to the json:api v1.1 specification, with OpenAPI 3 as the authoritative contract. json:api is not just an envelope choice — it is the wire-format specification ION services implement (resource objects, relationships, links, pagination, content type application/vnd.api+json, and error object shape all per the spec). Long-running requests that exceed a comfortable synchronous latency budget use the Async REST pattern (202 Accepted + status polling + result retrieval). Concretely:

1. Protocol & style

  • RESTful HTTP/JSON conforming to json:api v1.1 for every service’s sync interface. Content type: application/vnd.api+json on both request and response bodies where the spec requires it.
  • Resource-oriented URLs (/v1/customers/{id}, /v1/incidents/{id}). Nouns for resources, sub-paths for relations; RPC-style verbs in the path are disallowed except for named sub-operations that don’t map cleanly to a resource lifecycle.
  • Standard HTTP methods: GET (safe/idempotent read), HEAD (metadata and health probes), POST (create / non-idempotent action), PUT / PATCH (update; PUT idempotent full replace, PATCH partial), DELETE (idempotent delete).
  • Standard status codes: 200/201/202/204 for success; 400/401/403/404/409/429 for client errors; 500/503 for server errors.

2. Contract — OpenAPI 3 first

  • OpenAPI 3 spec is the source of truth, checked into the service’s repo (e.g. api/specs/openapi.yaml per the Internal API pattern).
  • The spec is what APIM imports for policy attachment (ADR-0014); developer portal and client SDKs are generated from it.
  • Any HTTP surface that isn’t in the OpenAPI spec doesn’t exist for APIM policy and consumer-tooling purposes.
  • json:api resource types, relationships, and response shapes are expressed via reusable #/components/schemas/ entries.

3. Versioning — URI-path major version

  • URI-path major versioning: /v1/…, /v2/…. Major version bumps only for breaking changes; additive changes are non-breaking and stay in the current major.
  • Version alignment with ADR-0005 event-type versioning (v1, v2, …) — a service’s HTTP major and event major move together.
  • Deprecation window and sunset headers per operation; APIM policy emits Deprecation / Sunset response headers when configured.

4. Response envelope & content type — json:api v1.1

  • Successful responses use the json:api v1.1 document structure: top-level data (resource object or array), included (compound documents), links, meta, and top-level jsonapi version object.
  • Resource objects carry type, id, attributes, relationships, and links per the spec.
  • Content type is application/vnd.api+json; Accept: application/vnd.api+json is required on requests.
  • Rationale: standard pagination, link relations, error object shape, and one consumer-SDK shape — with a published spec to point conformance disputes at.

5. Pagination — cursor-based (opaque forward cursor)

Collection endpoints paginate via opaque forward cursors, exposed through json:api’s standard pagination link relations:

  • Request: ?page[size]=<n>&page[after]=<opaque-cursor> — the page[after] cursor is opaque to the client (base64-encoded server state).
  • Response links: self, next (present if more results exist), prev (optional; may be absent if the server doesn’t support backward navigation).
  • Response meta: MAY include pageSize and a boolean hasMore; MUST NOT include a total count unless the underlying store makes totals cheap (Cosmos DB event stores and most projections do not).
  • Default page size and max page size are declared per operation in the OpenAPI spec; APIM enforces max page size.

Cursors encode the sort key of the last-seen item plus a stable tiebreaker (usually the resource id). Cursors are not stable across schema/index changes — clients treat them as ephemeral session state, not durable references.

6. Filtering, sorting, sparse fieldsets — per json:api spec

  • Filtering: ?filter[<field>]=<value> per json:api. Each service declares supported filter fields in OpenAPI; unsupported filter fields return 400 Bad Request with a json:api error object (source.parameter pointing at the offending query key).
  • Sorting: ?sort=<field> (ascending) or ?sort=-<field> (descending). Multi-field sort as comma-separated: ?sort=-createdAt,id. Each service declares supported sort fields in OpenAPI.
  • Sparse fieldsets: ?fields[<type>]=<comma-separated-fields> per json:api — clients opt in when they need it; services that can’t cheaply project subsets MAY reject with 400 for now (this is a per-operation capability, declared in OpenAPI).
  • Full-text search is out of scope of this ADR — services that need it expose a distinct search operation, not a generic filter.

7. Error shape — json:api error objects

  • JSON body follows the json:api errors array shape, with fields status, code, title, detail, and meta.correlationId (see json:api v1.1 § Errors for the full field list).
  • 4xx errors MUST include meta.correlationId so support can trace across APIM + backend logs.
  • 5xx errors from backend surface as opaque 500 to consumers; APIM strips backend detail.

Note on the Internal API worked example. The { statusCode, message } shape shown in references/Architecture- Internal API.md predates this standardization and is retained on that surface until it can be migrated. New APIs MUST use the json:api error-object shape above.

8. Correlation & observability

  • Every request MUST carry a x-correlation-id header; if the caller doesn’t provide one, APIM generates one and echoes it back.
  • The correlation ID propagates into backend logs, backend-emitted events (CloudEvents traceparent extension per ADR-0005), and the Async REST job record — so a single x-correlation-id walks the HTTP → event → workflow chain end-to-end.
  • W3C traceparent is honoured when present; APIM injects it if missing.

9. Rate limiting

  • Per-identity (by JWT oid claim), enforced at APIM.
  • X-RateLimit-<api>-Remaining-User header returned on success; 429 Too Many Requests + Retry-After on throttle. The Internal API worked example (50 successful requests / 60 s) is illustrative of the pattern, not a platform-wide default.

10. Async REST — 202 + status polling + result

For operations whose expected duration exceeds ~2 seconds and does not warrant a Temporal workflow (see boundary below):

  1. POST /<resource> — accepts the request, enqueues work, returns 202 Accepted with a Location: /<resource>/{jobId} header and body { "jobId": "…", "status": "Pending" }.
  2. GET /<resource>/{jobId}/status — returns current status (Pending / Running / Succeeded / Failed) and, when Succeeded, a resultUri pointing to the result endpoint.
  3. GET /<resource>/{jobId} — returns the final result once status is Succeeded.

Implementation is service-local: queue-based load levelling (Service Bus queue or in-service queue) with an idempotent worker. The pattern is standardized; the substrate is not.

11. Boundary: Async REST vs Temporal (ADR-0019)

PropertyAsync RESTTemporal workflow
Expected durationSeconds to minutesMinutes to days
Durable across process restartsBest-effort (queue durability only)First-class (workflow history)
External signals mid-flightNot supportedFirst-class (signals)
Versioning of in-flight workN/A (short-lived)First-class (GetVersion)
Replay / debuggingLogs onlyFull replay from history
Substrate costOwned by serviceCogs + Temporal cluster
Sanctioned useReport generation, bulk queries, expensive projectionsTriage / investigation / response runbooks (see ADR-0019)

Async REST is not a substitute for Temporal; it is the pattern for operations that need HTTP-shaped ergonomics and don’t need workflow semantics.

12. Authentication & authorization (recap)

  • All ION APIs sit behind APIM (ADR-0014) behind Front Door + AppGW (ADR-0015).
  • User tokens terminate at BFFs (ADR-0013); service-to-service calls carry the caller’s UAMI-issued token audience = ION Platform API app; APIM validates audience + role claims.

Alternatives Considered

This ADR bundles several sub-decisions (protocol, contract format, envelope/spec, versioning, pagination, filtering, long-running-op pattern). Alternatives are grouped per sub-decision.

Protocol & style

Option A — gRPC (Protocol Buffers over HTTP/2)

Rejected — decisive: APIM and Azure edge tooling do not treat gRPC as first-class along the ION path. Reinforcing: consumer-tooling ecosystem for internal tools (Python, PowerShell, browser-based dev portal) is REST/OpenAPI-native; § 21 alignment weaker (Azure PaaS integration is REST/OpenAPI-first).

gRPC has real strengths (streaming, tight schemas, low overhead) but none of ION’s sync-leg use cases need those. Publish/subscribe is already covered by CloudEvents over Service Bus, which handles ION’s streaming needs. Making the sync leg gRPC would add a second edge topology, a second contract format, and a second observability contract for negligible benefit.

Option B — GraphQL

Rejected — decisive: composition and view-shaping already belong to BFFs. Reinforcing: GraphQL layer would duplicate BFF responsibility; APIM policy attachment on GraphQL operations is second-class.

GraphQL’s value proposition — one endpoint, client-shaped queries — is already delivered by the BFF pattern (§ 13). BFFs compose across domain-service REST calls and shape the response for each frontend. Adding GraphQL as a platform-wide sync leg would either replace BFFs (rejected — BFFs terminate user tokens and enforce authorization narrowly) or duplicate their job.

Option C — RPC-style HTTP (verbs in the path, POST-only)

Rejected — decisive: breaks HTTP caching, rate-limiting, and idempotency semantics that APIM + Front Door depend on. Reinforcing: weaker consumer tooling ergonomics — every operation looks like a black box.

RPC-style APIs (POST /doThing) forfeit the resource orientation that REST + APIM policy attachment assumes. HTTP method semantics carry weight in ION’s edge topology: GET is cacheable and idempotent-safe at Front Door; HEAD is the liveness contract; PUT/DELETE are idempotent for retry.

Option D — WebSockets / Server-Sent Events (SSE) as the sync leg

Rejected — decisive: WebSockets/SSE are duplex/streaming channels, not request/response. Not a rejection of WebSockets/SSE elsewhere — Azure SignalR is the sanctioned channel for UI real-time push (see capacity model UI section: SignalR handles server → client notifications; requests still go over REST).

This ADR’s decision is scoped to the request/response sync leg of the Trilateral API. Push channels are complementary, not substitutes.

Option E — No standard; per-service choice

Rejected — decisive: fragments APIM policy, consumer tooling, and observability across the platform.

The whole point of the Trilateral API rule (§ 10) is a uniform contract model. Sync-leg divergence would defeat APIM’s policy-attachment leverage (ADR-0014) and force every consumer to learn N contracts.

Envelope / wire-format spec

Option S1 — Plain JSON, no envelope, no spec

Rejected — decisive: no shared conformance target for pagination, relationships, errors, and links. Reinforcing: every service reinvents these shapes; consumer SDKs cannot be shared.

Plain JSON leaves every service to design its own pagination keys, error shape, link relations, and relationship representation. That is exactly the fragmentation the Trilateral API rule (§ 10) is meant to prevent.

Option S2 — HAL (Hypertext Application Language)

Rejected — decisive: weaker specification of pagination, errors, sparse fieldsets, and filtering than json:api. Reinforcing: smaller ecosystem for OpenAPI + code generators in the languages ION uses.

HAL nails hypermedia links but leaves pagination, filtering, and error shapes to convention. json:api is the tighter contract.

Option S3 — OData

Rejected — decisive: query surface area is far larger than ION needs ($expand, $select, $filter DSL, $orderby, $compute, $search). Reinforcing: APIM policy attachment and custom validation are harder against an open OData query DSL; § 21 fit weaker — no first-class Azure OData toolchain we would rely on.

OData’s power is its downside for a platform whose backends are event stores and projections: an unbounded query DSL either exposes expensive queries (Cosmos DB RU blowups) or forces per-endpoint allowlists that end up specifying a smaller surface than json:api would have given us.

Option S4 — Custom Ontinue envelope

Rejected — decisive: reinventing a spec. Reinforcing: no conformance test suite, no consumer-side SDKs, no public documentation to point disputes at.

Using an internal envelope surrenders exactly what makes a spec valuable: a stable, external target that consumers can code against without reading ION source.

Versioning strategy

Option V1 — URI-path major version (/v1/…) (selected — see Decision § 3)

Option V2 — Header-based versioning (Accept: application/vnd.ion.v1+json)

Rejected — decisive: harder to route, cache, and inspect at APIM, Front Door, and consumer tooling. Reinforcing: worse ergonomics for cURL/browser exploration and dev-portal navigation.

Header-based versioning is technically the “cleanest” HTTP posture, but it hides the version from URL-level policy attachment in APIM and from log/trace enrichment based on path.

Option V3 — Query-string versioning (?api-version=1)

Rejected — decisive: query strings are part of resource identity for caching; mixing version into the query obscures cache keys and invites accidental version pinning by clients passing whole query strings around. Reinforcing: not idiomatic for json:api resources.

Option V4 — No versioning; break freely with deprecation notices

Rejected — decisive: incompatible with the Trilateral API rule (§ 10) treating breaking changes as first-class contract events. Reinforcing: breaks in-flight consumer clients with no upgrade ramp.

Option V5 — Semantic versioning in the URL (/v1.2/…)

Rejected — decisive: additive (minor) changes should not force URL migration. SemVer’s minor bumps have no client-visible effect by definition; putting them in the URL surfaces a churn signal that isn’t real.

Pagination strategy

Option P1 — Cursor-based (opaque forward cursor) (selected — see Decision § 5)

Option P2 — Offset/limit (?page[number]=<n>&page[size]=<n>)

Rejected — decisive: unstable results under concurrent writes (new items shift page boundaries, causing dupes/skips). Reinforcing: expensive at deep offsets on Cosmos DB and SQL projections (offset requires scanning skipped rows/RUs); total-count requirement is prohibitively expensive on event stores.

ION’s collection endpoints back onto event stores (Cosmos DB) and projections that are frequently written to; offset-based pagination is exactly the wrong shape.

Option P3 — Keyset pagination with client-visible sort key

Rejected — decisive: exposes internal sort keys and tiebreakers to clients, coupling clients to storage layout. Reinforcing: clients must know how to construct the next key, which cursors hide behind an opaque token.

Keyset is functionally equivalent to cursor pagination server-side; the only difference is whether the state is opaque (cursor) or exposed (keyset). Opaque is strictly better for encapsulation.

Option P4 — Page tokens with server-side page cache

Rejected — decisive: per-service page cache is an additional stateful surface with its own eviction, TTL, and consistency problems for no gain over opaque cursors.

Option P5 — No pagination; return all results

Rejected — decisive: unbounded response sizes. Trivially breaks at ION scale (incidents/day per capacity model). Retained only for fixed-size lookup endpoints (e.g. /v1/customers where customer count is small and bounded) — those still expose the pagination surface for future-proofing.

Filtering strategy

Option F1 — ?filter[<field>]=<value> per json:api spec (selected — see Decision § 6)

Option F2 — RSQL / FIQL query DSL

Rejected — decisive: unbounded query surface exposes expensive queries against Cosmos DB / projections. Reinforcing: APIM policy cannot validate the DSL without shipping a parser; consumer tooling support is thin.

Option F3 — OData $filter sub-language

Subsumed by Envelope Option S3 (OData) above — rejected on the same grounds.

Option F4 — GraphQL-style nested filter objects

Rejected — decisive: BFF already owns cross-resource composition (§ 13); adding a nested filter language to REST endpoints duplicates BFF’s job for negligible benefit.

Option F5 — POST-with-filter-body (search-endpoint pattern) as the default

Rejected as the default — breaks HTTP caching and idempotency for collection reads. Retained as a per-service escape hatch for genuinely complex search operations that can’t fit into filter[] parameters (declared explicitly in OpenAPI as POST /<resource>/search).

Long-running operation pattern

Option L1 — Async REST 202 + polling (selected — see Decision § 10)

Option L2 — Long-lived synchronous HTTP

Rejected — decisive: Front Door and APIM timeout budgets are bounded and non-negotiable at the edge. Reinforcing: holds HTTP connections open at the edge → resource exhaustion under load; breaks retry semantics (client retry re-runs the whole operation).

Long-lived sync HTTP is a bad shape for report generation, bulk queries, or expensive projections. The Async REST pattern is the sanctioned way to expose those over HTTP without a Temporal workflow.

Option L3 — Webhook callbacks (server → client HTTP POST on completion)

Rejected — decisive: consumers (including internal Ontinue tooling) vary in ability to host an inbound HTTP endpoint reachable by ION. Reinforcing: security (mutual TLS / signed callbacks) adds nontrivial setup per consumer; polling is uniform and works from any caller.

Webhooks remain a fit for outbound event notifications to customer systems (Pigeon / customer collaboration) — that is a different surface than sync-API long-running operations.

Option L4 — SignalR / WebSocket push for job completion

Rejected as the default — not every caller (including S2S integrations) can hold a WebSocket connection. Retained as a complement for UI real-time push (browser BFF → SignalR), layered on top of the Async REST job model, not replacing it.

Option L5 — Force everything through Temporal

Rejected — decisive: Temporal cluster (§ 21 exception per ADR-0019) is not the right substrate for report generation, bulk queries, or expensive projections that don’t need durable state or signals. Reinforcing: inflates Temporal cluster load with short-lived work.

Rationale

REST + OpenAPI wins because it is the ecosystem ION already sits inside — APIM, Front Door, Azure SDKs, Entra token audiences, developer portals, and consumer tools all assume REST/OpenAPI as the first-class shape. Every alternative would require a parallel toolchain for marginal gain.

json:api is chosen over plain JSON, HAL, and OData because it is the tightest published specification for the exact surface ION needs — resource + relationship representation, pagination link relations, sparse fieldsets, and error objects — without the unbounded query DSL that OData drags in. A published spec matters: consumers get a conformance target that isn’t ION source code.

URI-path versioning is chosen over header/query/no-versioning because it aligns with how APIM policy, Front Door routing, and observability enrichment already key off the path. It also lines up with event-type versioning (ADR-0005) so a service’s HTTP major and event major move together.

Cursor pagination is chosen over offset/keyset/no-pagination because ION’s collection endpoints back onto Cosmos DB event stores and projections. Offset pagination is unstable under concurrent writes and expensive at depth; exposing raw keyset couples clients to storage layout; opaque cursors give correctness + encapsulation and match json:api’s link-relation model natively.

json:api filter/sort/sparse-fieldset conventions are chosen over RSQL/OData/GraphQL-style filters because they give a bounded, per-endpoint-declared query surface that APIM can validate and backends can serve without RU/query-cost blowups.

Async REST closes the gap between “instant HTTP call” and “durable workflow”. Without it, teams either force everything into Temporal (over-engineering short-lived operations) or hold HTTP connections open past edge timeouts (breaking under load). The 202 + polling shape is well-understood, edge-friendly, idempotent-safe, and works from any caller (unlike webhooks or WebSocket push).

Consequences

Positive

  • One API style across ION → uniform APIM policy, uniform BFF client code, uniform consumer SDKs, uniform observability contract.
  • OpenAPI-first + json:api conformance enables APIM policy attachment, dev portal generation, contract tests, and client SDK generation as a single toolchain.
  • Cursor pagination scales cleanly on event-store-backed collections and doesn’t require expensive total-count queries.
  • Bounded filter/sort surface (declared per-operation in OpenAPI) keeps Cosmos DB query costs predictable.
  • Async REST unblocks long-running operations without breaking edge timeouts and without pulling every long operation into Temporal.
  • Correlation-ID discipline gives support one identifier that walks the HTTP → event → workflow chain.

Negative

  • Services doing genuinely streaming workloads (rare in ION today) must either fit REST + Async REST semantics or apply for an exception.
  • OpenAPI-spec maintenance is a per-service tax; drift between spec and implementation is a real risk without contract tests.
  • json:api document structure is verbose vs plain-JSON responses — a bandwidth cost that is negligible at ION’s payload sizes but not zero; SDK/tooling learning curve exists for teams new to the spec.
  • Cursor opacity means clients cannot “jump to page N” — acceptable for ION’s UI patterns (infinite scroll, streaming lists) but a mismatch for any “give me the last page” use case.
  • Bounded filter/sort surface means new filter needs require an OpenAPI update + APIM policy refresh — friction is intentional.
  • Async REST introduces per-service job storage that has its own retention, cleanup, and idempotency concerns — service-local, not platform-shared.
  • The Internal API worked example still uses a pre-json:api error shape; migration to json:api error objects is a follow-up.

Neutral / follow-ups

  • Publish standards/api-standards.md capturing the concrete rules (json:api conformance, versioning, pagination cursor discipline, filter/sort declaration, error object shape, correlation).
  • Publish patterns/async-rest.md capturing the 202 + polling shape and the Async REST vs Temporal boundary.
  • Contract-test convention (spec-vs-implementation drift check) is a follow-up standard, not resolved here.
  • Migrate the Internal API error shape to json:api error objects during its next major bump.
  • WebSockets/SignalR for UI real-time push is out of scope; documented separately in the reporting/UI ADRs.
  • Revisit gRPC only if a concrete sync-leg workload emerges that REST + Async REST cannot serve (currently: none).

WAF Pillar Impact

  • Primary pillar: operational-excellence — one API contract shape across every ION service and every consumer, one APIM policy model, one observability contract.
  • Secondary pillars: performance-efficiency (Async REST unblocks long-running operations without holding edge connections open; json:api pagination scales collection responses); security (uniform token audience/role model and rate limits enforced at APIM).
  • Trade-offs: No native streaming on the sync leg; genuinely streaming workloads must fit REST semantics or use CloudEvents on the event backbone. OpenAPI-spec maintenance is a per-service tax paid to keep APIM policy and consumer tooling working.

Previous approach (V2)

The convention set documented in this ADR was already the informal V2 practice across most services (per Architecture- API Guidelines.md and Architecture- Internal API.md). V2 lacked (a) a codified rule tying the practice to the Trilateral API principle, (b) a sanctioned long-running-operation pattern (leading to ad-hoc long-lived HTTP calls or premature Temporal adoption), and (c) a common correlation-ID discipline across HTTP + event legs. This ADR retrospectively codifies what worked and closes the three gaps.

References

  • references/Architecture- API Guidelines.md — Trilateral API, CloudEvents, AsyncAPI, and event schema conventions.
  • references/Architecture- Internal API.md — worked consumer example: Front Door → APIM → backend, JWT audience per environment, json:api responses, rate limiting, error shape.
  • references/Design Pattern- ASYNC Rest API.md — the 202 + polling pattern.
  • references/Authentication & Authorisation Patterns.md — token acquisition and audience conventions.
  • External: OpenAPI 3 — https://spec.openapis.org/oas/v3.1.0
  • External: json:api — https://jsonapi.org/
  • External: W3C Trace Context — https://www.w3.org/TR/trace-context/

Related ADRs

  • Depends on: ADR-0001 (Trilateral API rule); ADR-0005 (event schema — versioning and correlation align with this ADR); ADR-0013 (auth model — BFF terminates user tokens; APIM validates S2S tokens); ADR-0014 (APIM ingress — policy attachment consumes OpenAPI); ADR-0015 (edge topology — timeout budgets that force Async REST).
  • Depended on by: pending Observability ADR (logging/metrics/tracing standards depend on correlation-ID discipline defined here); pending Reporting Data Store ADR (report generation flows will use Async REST); pending MFE UI ADR (BFF ↔ MFE contracts).
  • Related: ADR-0019 (Temporal vs Async REST boundary — this ADR documents it).

On this page

  • Context
  • Forces / Drivers
  • Decision
  • 1. Protocol & style
  • 2. Contract — OpenAPI 3 first
  • 3. Versioning — URI-path major version
  • 4. Response envelope & content type — json:api v1.1
  • 5. Pagination — cursor-based (opaque forward cursor)
  • 6. Filtering, sorting, sparse fieldsets — per json:api spec
  • 7. Error shape — json:api error objects
  • 8. Correlation & observability
  • 9. Rate limiting
  • 10. Async REST — 202 + status polling + result
  • 11. Boundary: Async REST vs Temporal (ADR-0019)
  • 12. Authentication & authorization (recap)
  • Alternatives Considered
  • Protocol & style
  • Envelope / wire-format spec
  • Versioning strategy
  • Pagination strategy
  • Filtering strategy
  • Long-running operation pattern
  • Rationale
  • Consequences
  • WAF Pillar Impact
  • Previous approach (V2)
  • References
  • Related ADRs
PreviousWorkflow substrate — self-hosted Temporal cluster (§ 21 exception)
NextObservability stack — Application Insights + Log Analytics + Azure Monitor Metrics, instrumented via OpenTelemetry
Edit on GitHubSecurity