Skip to main content
POST
/
api
/
services
/
{domain}
/
{service}
/
invoke
/
{method}
Invoke Service Method
curl --request POST \
  --url https://api.example.com/api/services/{domain}/{service}/invoke/{method} \
  --header 'Content-Type: application/json' \
  --data '{
  "body": {}
}'
{
  "200": {},
  "404": {},
  "500": {},
  "result": {}
}

Endpoint

POST /api/services/{domain}/{service}/invoke/{method}

Path Parameters

domain
string
required
The domain/namespace of the service (e.g., example, myapp)
service
string
required
The service name (e.g., hello, calculator, txt2img)
method
string
required
The method name to invoke (e.g., greet, add, generate)

Request Body

body
object | bytes
required
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

result
object | bytes | stream
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"}'
Response
{
  "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}'
Response
{
  "result": 100
}

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

200
Success
Method invoked successfully, response in body
404
Not Found
Service or method not found
500
Internal Server Error
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