docs: Add API routes
All checks were successful
/ pre-commit (push) Successful in 1m47s

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2025-08-26 11:45:27 +02:00
parent 0ce540e92d
commit 7c94a62d80
Signed by: jriou
GPG key ID: 9A099EDA51316854

View file

@ -33,3 +33,43 @@ The file format is **JSON**:
* **observation_internal** (int): Number of seconds to wait between two observations (default 60)
The configuration file is not required but the service might not be exposed to the public.
## API
### GET /health
Returns 200 OK.
### POST /api/note
Create a note.
Body (JSON):
* **content** (string): base64 encoded content (required)
* **password** (string): user-provided password
* **encrypted** (bool): true if the note has been encrypted by the client
* **expiration** (int): lifetime of the note in seconds (must be supported by the server)
* **delete_after_read** (bool): delete the note after the first read
Response (JSON):
* **id** (string): ID of the note
### GET /<id>/<password>
> [!IMPORTANT]
> Potential password leak
Return content of a note encrypted by the given password.
### GET /<id>
Return content of a note.
If the note is encrypted, the encrypted value is returned (application/octet-stream). Otherwise, the text is returned (text/plain).
### Errors
Errors return **500 Server Internal Error** with the **JSON** payload:
* **message** (string): message of the response
* **error** (string): error if any