Endpoint
POST /api/services/{domain}/{service}/invoke/{method}
Path Parameters
The domain/namespace of the service (e.g., example, myapp)
The service name (e.g., hello, calculator, txt2img)
The method name to invoke (e.g., greet, add, generate)
Request Body
The request body can be either:
- JSON object: Method parameters as JSON
- Raw bytes: Binary data for the method
The format depends on the service method’s expected input type.
Response
The method response can be:
- JSON object: Structured response data
- Raw bytes: Binary response data
- Stream: Streaming response (e.g., for large datasets or real-time output)
Examples
Simple JSON Request/Response
curl -X POST http://localhost:9481/api/services/example/hello/invoke/greet \
-H "Content-Type: application/json" \
-d '{"name": "World"}'
{
"result": "Hello, World!"
}
Calculator Service
curl -X POST http://localhost:9481/api/services/math/calculator/invoke/add \
-H "Content-Type: application/json" \
-d '{"a": 42, "b": 58}'
Binary Data (Image Generation)
curl -X POST http://localhost:9481/api/services/ai/txt2img/invoke/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "A sunset over mountains", "steps": 30}' \
--output generated.png
Returns raw PNG image data.
Streaming Response
curl -X POST http://localhost:9481/api/services/data/processor/invoke/process \
-H "Content-Type: application/json" \
-d '{"dataset": "large_file.csv"}' \
-N # No buffering for streaming
Returns streaming response as data is processed.
Status Codes
Method invoked successfully, response in body
Service or method not found
Service method execution failed
Notes
- Method names are case-sensitive
- JSON requests must have
Content-Type: application/json header
- Binary requests can use
Content-Type: application/octet-stream
- Streaming responses use chunked transfer encoding
- Request timeout is configurable (default: 30 seconds)
See Also