Standards for synchronous service communication.
SEA™ follows consistent REST API patterns for all synchronous communication:
| Principle | Implementation |
|---|---|
| Resource-oriented | Noun-based URLs |
| HATEOAS | Links in responses |
| Versioning | URL path versioning |
| Idempotency | Idempotency keys for mutations |
| Rate limiting | Token bucket per client |
1
/api/v{version}/{resource}/{id?}/{sub-resource?}
1
2
3
4
5
6
7
8
GET /api/v1/cases # List cases
POST /api/v1/cases # Create case
GET /api/v1/cases/{id} # Get case
PATCH /api/v1/cases/{id} # Update case
DELETE /api/v1/cases/{id} # Delete case
GET /api/v1/cases/{id}/tasks # List case tasks
POST /api/v1/cases/{id}/tasks # Create task in case
| Header | Required | Purpose |
|---|---|---|
Authorization |
Yes | Bearer token |
Content-Type |
Yes | application/json |
X-Request-Id |
No | Tracing correlation |
X-Idempotency-Key |
POST/PUT | Prevent duplicates |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
"data": {
"id": "case-123",
"type": "case",
"attributes": {
"title": "New Case",
"status": "open"
},
"links": {
"self": "/api/v1/cases/case-123",
"tasks": "/api/v1/cases/case-123/tasks"
}
},
"meta": {
"requestId": "req-abc-123"
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input",
"details": [
{
"field": "title",
"code": "REQUIRED",
"message": "Title is required"
}
]
},
"meta": {
"requestId": "req-abc-123"
}
}
| Code | Usage |
|---|---|
200 |
Success with body |
201 |
Created |
204 |
Success, no body |
400 |
Validation error |
401 |
Unauthenticated |
403 |
Forbidden |
404 |
Not found |
409 |
Conflict (duplicate) |
422 |
Unprocessable entity |
429 |
Rate limited |
500 |
Server error |
1
GET /api/v1/cases?page=2&limit=20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"data": [...],
"pagination": {
"page": 2,
"limit": 20,
"total": 150,
"totalPages": 8
},
"links": {
"self": "/api/v1/cases?page=2&limit=20",
"first": "/api/v1/cases?page=1&limit=20",
"prev": "/api/v1/cases?page=1&limit=20",
"next": "/api/v1/cases?page=3&limit=20",
"last": "/api/v1/cases?page=8&limit=20"
}
}
1
GET /api/v1/cases?filter[status]=open&filter[priority]=high
1
GET /api/v1/cases?sort=-createdAt,title
Prefix - for descending order.
1
2
3
4
# Client generates unique key
curl -X POST /api/v1/cases \
-H "X-Idempotency-Key: client-uuid-123" \
-d '{"title": "New Case"}'
1
2
3
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1704067200
1
2
3
4
5
6
7
{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests",
"retryAfter": 60
}
}
All APIs are documented via OpenAPI 3.0:
1
2
3
4
5
# View API docs
open http://localhost:8000/docs
# Download spec
curl http://localhost:8000/openapi.json