Estratto dalla documentazione API del progetto Errantia Excerpt from the Errantia project API documentation
Le API di Errantia permettono di gestire oggetti erranti, avvistamenti e profili artigiani. Tutte le richieste e risposte utilizzano formato JSON. L'autenticazione avviene tramite JWT token.
Effettua il login di un artigiano e restituisce un access token JWT valido per 24 ore.
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
| string | Sì | Email dell'artigiano | |
| password | string | Sì | Password (min 8 caratteri) |
Crea un nuovo oggetto errante. L'artigiano deve essere autenticato e verificato. Il sistema genera automaticamente un codice univoco e l'URL NFC.
| Header | Valore | Descrizione |
|---|---|---|
| Authorization | Bearer {token} | JWT token ottenuto dal login |
| Content-Type | application/json | Formato della richiesta |
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
| name | string | Sì | Nome oggetto (max 100 caratteri) |
| message | string | Sì | Messaggio/dedica (max 500 caratteri) |
| description | string | No | Descrizione dettagliata (max 2000 caratteri) |
Recupera le informazioni pubbliche di un oggetto errante tramite il suo codice univoco. Questa API è chiamata dalla landing page NFC quando un utente scansiona il tag.
| Parametro | Tipo | Descrizione |
|---|---|---|
| code | string | Codice univoco dell'oggetto (es. ABC123) |
| Codice | Significato | Quando viene usato |
|---|---|---|
| 200 | OK | Richiesta GET riuscita |
| 201 | Created | Risorsa creata con successo (POST) |
| 400 | Bad Request | Dati di input non validi |
| 401 | Unauthorized | Token mancante o non valido |
| 403 | Forbidden | Accesso negato (es. artigiano non verificato) |
| 404 | Not Found | Risorsa non trovata |
| 500 | Internal Server Error | Errore generico del server |
Questa documentazione API è la single source of truth per frontend e backend:
docs/ANALISI_TECNICA.md versionato in GitThe Errantia APIs allow managing wandering objects, sightings, and artisan profiles. All requests and responses use JSON format. Authentication is done via JWT token.
Performs artisan login and returns a JWT access token valid for 24 hours.
| Parameter | Type | Required | Description |
|---|---|---|---|
| string | Yes | Artisan email | |
| password | string | Yes | Password (min 8 characters) |
Creates a new wandering object. The artisan must be authenticated and verified. The system automatically generates a unique code and NFC URL.
| Header | Value | Description |
|---|---|---|
| Authorization | Bearer {token} | JWT token obtained from login |
| Content-Type | application/json | Request format |
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Object name (max 100 characters) |
| message | string | Yes | Message/dedication (max 500 characters) |
| description | string | No | Detailed description (max 2000 characters) |
Retrieves public information about a wandering object by its unique code. This API is called by the NFC landing page when a user scans the tag.
| Parameter | Type | Description |
|---|---|---|
| code | string | Unique object code (e.g., ABC123) |
| Code | Meaning | When used |
|---|---|---|
| 200 | OK | Successful GET request |
| 201 | Created | Resource created successfully (POST) |
| 400 | Bad Request | Invalid input data |
| 401 | Unauthorized | Missing or invalid token |
| 403 | Forbidden | Access denied (e.g., unverified artisan) |
| 404 | Not Found | Resource not found |
| 500 | Internal Server Error | Generic server error |
This API documentation is the single source of truth for frontend and backend:
docs/ANALISI_TECNICA.md versioned in Git