Files
ad/molodetz/templates/docs/prose/api.md
T

29 lines
887 B
Markdown
Raw Normal View History

# API and authentication
2026-10-05 09:36:20 +02:00
Every route has four faces: HTML, JSON, documentation and (where selected) an assistant tool. Ask for JSON with `Accept: application/json`.
2026-10-05 09:36:20 +02:00
## Authentication
2026-10-05 09:36:20 +02:00
Resolution order:
2026-10-05 09:36:20 +02:00
1. `session` cookie (64 hex characters) after logging in at `/auth/login`.
2. `X-API-KEY` header with your API key.
3. `Authorization: Bearer <key>`.
4. `Authorization: Basic` with name or email and password.
2026-10-05 09:36:20 +02:00
There is no JWT and no OAuth.
2026-10-05 09:36:20 +02:00
## Example
2026-10-05 09:36:20 +02:00
```bash
curl -H 'Accept: application/json' https://molodetz.nl/roll
2026-10-05 09:36:20 +02:00
```
## Errors
2026-10-05 09:36:20 +02:00
Errors have the shape `{"error": {"status": 404, "message": "..."}}`. Validation errors return `422` with `{"error": "validation", "fields": [...], "messages": [...]}`.
## Old paths
The Dutch paths from before (`/rol`, `/standaard`, `/mensen`, `/binnen`, `/voorwaarden`) answer with a 301 to their English replacement. Query strings are kept.