Skip to content

REST-API-Referenz

Endpunkte der nene2-python-Beispielanwendung.

Maschinenlesbares Schema: Führen Sie uv run python src/scripts/export_openapi.py aus, um docs/openapi.yaml zu generieren.
Interaktive Dokumentation: Starten Sie den Entwicklungsserver und öffnen Sie http://localhost:8080/docs.


Notes

GET /notes

Notizen mit Paginierung auflisten.

Query-Parameter

ParameterTypStandardBeschreibung
limitint20Maximale Ergebnisse (max. 100)
offsetint0Anzahl der zu überspringenden Ergebnisse

Antwort 200 OK

json
{
  "items": [{"id": 1, "title": "My note", "body": "Content"}],
  "limit": 20,
  "offset": 0,
  "total": 1
}

POST /notes

Eine Notiz erstellen.

Request-Body

json
{"title": "Title", "body": "Body text"}

Antwort 201 Created

json
{"id": 1, "title": "Title", "body": "Body text"}

GET /notes/{note_id}

Eine einzelne Notiz abrufen. Gibt 404 zurück, wenn nicht gefunden.

PUT /notes/{note_id}

Eine Notiz aktualisieren.

Request-Body

json
{"title": "New title", "body": "New body"}

Antwort 200 OK / 404 Not Found

DELETE /notes/{note_id}

Eine Notiz löschen. Gibt 204 No Content / 404 Not Found zurück.


Tags

/tags folgt demselben CRUD-Muster wie Notes.

MethodePfadBeschreibung
GET/tagsTags auflisten
POST/tagsTag erstellen ({"name": "..."})
GET/tags/{tag_id}Tag abrufen
PUT/tags/{tag_id}Tag aktualisieren ({"name": "..."})
DELETE/tags/{tag_id}Tag löschen

Comments

Kommentare sind unter einer Notiz verschachtelt.

MethodePfadBeschreibung
GET/notes/{note_id}/commentsKommentare auflisten
POST/notes/{note_id}/commentsKommentar erstellen ({"body": "..."})
GET/notes/{note_id}/comments/{comment_id}Kommentar abrufen
PUT/notes/{note_id}/comments/{comment_id}Kommentar aktualisieren
DELETE/notes/{note_id}/comments/{comment_id}Kommentar löschen

Health

GET /health

Gibt den Anwendungs-Gesundheitsstatus zurück.

Antwort 200 OK

json
{"status": "ok", "db": "ok"}

db ist "error", wenn die Datenbankverbindung fehlschlägt.


Fehlerantworten

Alle Fehler verwenden das Format RFC 9457 Problem Details.

json
{
  "type": "https://nene2.dev/problems/not-found",
  "title": "Not Found",
  "status": 404,
  "detail": "Note with ID 42 was not found."
}
StatustypeUrsache
400bad-requestFehlerhafte Anfrage
401unauthorizedAuthentifizierungsfehler
404not-foundRessource existiert nicht
413payload-too-largeBody überschreitet Größenlimit
422validation-failedEingabevalidierungsfehler
429too-many-requestsRate-Limit überschritten
500internal-server-errorUnbehandelter Serverfehler

Veröffentlicht unter der MIT-Lizenz.