Repository navigation
6.1 REST API Endpoints
Wiki Keeper (Grok Bot) edited this page Oct 15, 2026
·
2 revisions
v0.2 contract for corpus_ipc_server (Axum 0.8, feature server). Sources: src/server.rs, docs/rest-api.md, contract tests in tests/server_contract.rs.
| Endpoint | Request body | Success 200 body | Error statuses |
|---|---|---|---|
POST /initialize |
{"model_path": string?} ({} ok) |
{"ok": true, "message": "initialized"} |
400, 415, 422, 502, 500 |
POST /process |
{"inputs": [f32, ...]} |
{"ok": true, "output": [f32, ...]} |
400, 409, 415, 422, 502, 500 |
POST /save_state |
{"model_path": string} |
{"ok": true, "message": "state saved"} |
400, 409, 415, 422, 502, 500 |
POST /reset |
none | {"ok": true, "message": "reset"} |
502, 500 |
Other methods → 405. Unknown paths → 404. save_state is backend-specific; current backends treat it as a successful no-op.
Non-2xx JSON bodies:
{"ok": false, "error": {"code": "<code>", "message": "<detail>"}}| Status | code |
Meaning |
|---|---|---|
| 400 | bad_request |
Malformed JSON / unreadable body |
| 415 | unsupported_media_type |
Missing or non-JSON Content-Type on body endpoints |
| 422 | invalid_input |
Schema/validation failure or BackendError::InvalidInput
|
| 409 | not_initialized |
/process or /save_state before /initialize or after /reset
|
| 502 | backend_error |
Other BackendError variants |
| 500 | internal_error |
e.g. poisoned backend mutex |
Mapping helpers: json_rejection, backend_error, ApiError in src/server.rs.
-
/processand/save_staterequireAppState.initialized == true(set after successful/initialize, cleared after successful/reset). -
/resetis idempotent; both shipped backends clear initialized state, so the next/processneeds/initializeagain (required for connection-oriented ZMQ). -
/initializeis idempotent on success.
The 0.1 surface answered application results with HTTP 200 and {"ok": false, "message"} on backend errors. v0.2 is not wire-compatible with that: real status classes, nested error object, and success bodies gain "ok": true (/process includes output). Request bodies for /process are unchanged.
- Home
- 1. Overview
- 1.1. Getting Started
- 1.2. Architecture Overview
- 1.3. Crate Exports and Module Map
- 2. Core Abstractions
- 2.1. IpcBackend Trait
- 2.2. HybridFlowBackend Trait
- 2.3. BackendFactory and BackendType
- 2.4. Error Handling
- 3. Backend Implementations
- 3.1. RustBackend
- 3.2. ZmqIpcBackend
- 3.3. ZMQ Readout Parsing and Golden Frames
- 3.4. Structured ZeroMQ IpcMessage Transport
- 4. IPC Protocol and Data Models
- 4.1. IpcMessage Protocol
- 4.2. Batch Data Types
- 4.3. NeuromodulatorSnapshot and Neuromodulator Packet
- 4.4. StimulusBatch and Runtime Ingress
- 4.5. Deserialization Hooks and Model Compat Aliases
- 5. Validation and Wire Compatibility
- 5.1. Validation Framework and ProtocolLimits
- 5.2. ValidationError and ValidationKind
- 5.3. WireCompatibility and Envelope Decoding
- 5.4. Canonical Wire-v1 Encoding
- 6. corpus_ipc_server HTTP Server
- 6.1. REST API Endpoints
- 6.2. Server Configuration and Deployment
- 7. Build, Dependencies, and Quality Gates
- 7.1. Cargo Features and Dependency Isolation
- 7.2. Testing Strategy
- 7.2.1. Wire-v1 Golden Test Vectors
- 7.2.2. Property-Based Wire Tests
- 7.3. CI, Coverage, and Release Qualification
- 8. Project History and Licensing
- 8.1. Naming History and Completed Renames
- 8.2. Licensing
- 9. Glossary