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

Fixes #10.

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 01031a24ab
Signed by: jriou
GPG key ID: 9A099EDA51316854

View file

@ -32,4 +32,44 @@ The file format is **JSON**:
* **prometheus_notes_metric** (string): Name of the notes count metric (default "collerd_notes")
* **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.
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): use server-side encryption with this password
* **encrypted** (bool): true if the content 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\>
> [!WARNING]
> 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): context of the error
* **error** (string): error message