Files
geointel/docs/13-implementation-traps/API_RESPONSE_RULES.md
T
Jens faeb58ef6d
GeoIntel release gates / Compile, test, contracts and builds (push) Successful in 1m49s
GeoIntel release gates / Python and npm vulnerability policy (push) Successful in 21s
GeoIntel release gates / Production AI image, SBOM and container scan (push) Successful in 5m39s
GeoIntel release gates / Deploy exact gated revision to Unraid (push) Failing after 58m43s
Initial public release
2026-08-31 21:56:53 +02:00

80 lines
1.1 KiB
Markdown

# API Response Rules
All API responses must be stable and implementation-friendly.
## Success Envelope
For single resources:
```json
{
"data": {},
"meta": {}
}
```
For lists:
```json
{
"data": [],
"meta": {
"count": 0,
"limit": 50,
"offset": 0
}
}
```
## Error Envelope
```json
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Human readable message",
"details": {},
"trace_id": "optional"
}
}
```
## Required Resource Fields
Most persisted resources should include:
- `id`
- `created_at`
- `updated_at`
Geospatial resources should also include:
- `crs`
- `bounds`
- `geometry_type` where applicable
Analysis resources should include:
- `status`
- `parameters`
- `outputs`
- `metrics`
- `error_message` when failed
## Pagination
Use `limit` and `offset` for V1. Cursor pagination can be added later if needed.
## Sorting
Default sort: newest first for projects, datasets, analyses and exports.
## Contract Drift Rule
If implementation changes any response shape, update:
- `contracts/api/`
- API docs
- frontend API client types
- tests