2026-10-05 09:36:20 +02:00
<!-- retoor <retoor@molodetz.nl> -->
{% extends "docs/base_docs.html" %}
{% block docs_content %}
< h1 > API: {{ group.title }}</ h1 >
< p > {{ group.description }}</ p >
2026-10-05 11:25:41 +02:00
< p class = "muted" > Every HTML route returns JSON with < code > Accept: application/json</ code > . Authentication: session cookie, < code > X-API-KEY</ code > , < code > Authorization: Bearer</ code > or < code > Basic</ code > .</ p >
2026-10-05 09:36:20 +02:00
{% for item in endpoints %}
< section class = "endpoint" data-endpoint data-method = "{{ item.method }}" data-path = "{{ item.path }}" data-auth = "{{ item.auth }}" data-negotiation = "{{ item.negotiation }}" data-destructive = "{{ '1' if item.destructive else '0' }}" >
< div class = "signature" >< span class = "method" > {{ item.method }}</ span >< code > {{ item.path }}</ code >< span class = "auth" > {{ item.min_role }}</ span ></ div >
< strong > {{ item.title }}</ strong >
{% if item.description %}< p > {{ item.description }}</ p > {% endif %}
{% if item.fields %}
2026-10-05 11:25:41 +02:00
< table class = "admin-table" >< thead >< tr >< th > Field</ th >< th > Type</ th >< th > Location</ th >< th > Required</ th ></ tr ></ thead >< tbody >
{% for f in item.fields %}< tr >< td >< code > {{ f.name }}</ code > {% if f.enum %}< div class = "allowed" > Allowed: {{ f.enum | join(', ') }}</ div > {% endif %}</ td >< td > {{ f.type }}</ td >< td > {{ f.location }}</ td >< td > {{ 'yes' if f.required else 'no' }}</ td ></ tr > {% endfor %}
2026-10-05 09:36:20 +02:00
</ tbody ></ table >
{% endif %}
< div class = "tabs" data-tabs >
< button type = "button" class = "active" data-tab = "curl" > cURL</ button >
< button type = "button" data-tab = "js" > JS</ button >
< button type = "button" data-tab = "python" > Python</ button >
2026-10-05 11:25:41 +02:00
< button type = "button" data-tab = "expected" > Expected</ button >
2026-10-05 09:36:20 +02:00
{% if item.interactive %}< button type = "button" data-tab = "live" > Live</ button > {% endif %}
</ div >
< pre data-panel = "curl" > {{ item.curl }}</ pre >
< pre data-panel = "js" hidden > const response = await fetch("{{ item.path }}", { method: "{{ item.method }}", headers: { "Accept": "application/json" } });
console.log(await response.json());</ pre >
< pre data-panel = "python" hidden > import httpx
print(httpx.request("{{ item.method }}", BASE + "{{ item.path }}", headers={"Accept": "application/json", "X-API-KEY": API_KEY}).json())</ pre >
2026-10-05 11:25:41 +02:00
< pre data-panel = "expected" hidden > {{ item.sample | tojson(indent=2) if item.sample is not none else 'No example' }}</ pre >
2026-10-05 09:36:20 +02:00
{% if item.interactive %}
< div data-panel = "live" hidden class = "tester" >
{% for f in item.fields %}
< div class = "field" >< label > {{ f.name }} ({{ f.location }})</ label >
{% if f.enum %}< select data-param = "{{ f.name }}" data-location = "{{ f.location }}" > {% for option in f.enum %}< option > {{ option }}</ option > {% endfor %}</ select >
{% else %}< input type = "text" data-param = "{{ f.name }}" data-location = "{{ f.location }}" value = "{{ f.example or '' }}" > {% endif %}
</ div >
{% endfor %}
2026-10-05 11:25:41 +02:00
< div class = "actions" >< button class = "button small" type = "button" data-send {% if item . auth != ' public ' and not viewer %} disabled title = "Log in to send" {% endif %} > Send</ button ></ div >
< pre data-response > Not sent yet.</ pre >
2026-10-05 09:36:20 +02:00
</ div >
{% endif %}
</ section >
{% endfor %}
{% if services %}
< h2 > Live services</ h2 >
{% for service in services %}
< section class = "endpoint" >< strong > {{ service.title }}</ strong > < code > {{ service.name }}</ code >< p > {{ service.description }}</ p >
2026-10-05 11:25:41 +02:00
< p class = "muted" > Fields: {% for f in service.fields %}< code > {{ f.key }}</ code > ({{ f.type }}){% if not loop.last %}, {% endif %}{% endfor %}</ p ></ section >
2026-10-05 09:36:20 +02:00
{% endfor %}
{% endif %}
{% endblock %}
{% block extra_js %}< script type = "module" src = "{{ static_url('/static/js/utils/ApiTester.js') }}" ></ script > {% endblock %}