| Required role: | ApiUser |
| POST | /impianti/{ImpiantoId}/files | Carica un nuovo file associandolo a un'entità Impianto. | ### Modalità di Upload supportate: 1. **Multipart/Form-Data (Raccomandato)**: Caricamento standard di file binari. Il campo `Nome` è opzionale; se non specificato, verrà mantenuto il nome originale del file. 2. **JSON (Base64)**: Caricamento tramite stringa codificata nel campo `Base64Content`. Utile per client che preferiscono inviare payload JSON puri. **Gestione Cartelle**: Il sistema individua automaticamente la cartella di destinazione tramite il `FileId` dell'Impianto. Se l'Impianto non ha ancora una cartella associata, questa verrà creata automaticamente. |
|---|
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| ImpiantoId | path | integer | Yes | ID univoco dell'Impianto di destinazione (usato per trovare o creare la cartella radice). |
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| Nome | form | string | No | Nome desiderato del file. Se omesso, viene utilizzato il nome originale del file caricato. |
| ConflictAction | form | FileConflictAction | Yes | Azione da intraprendere se un file con lo stesso nome esiste già nella cartella. Valori possibili: **0 (Error)**, **1 (Rename)**, **2 (Overwrite)**. Consultare i dettagli di ciascun valore per la logica completa. |
| Base64Content | form | string | No | Contenuto del file codificato in Base64. **OPZIONE IBRIDA**: Usare questo campo se la richiesta è di tipo 'application/json'. |
| Error | |
| Rename | |
| Overwrite |
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| FileId | form | long | No | |
| FinalFileName | form | string | No | |
| IsUpdate | form | bool | No | |
| ResponseStatus | form | ResponseStatus | No |
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /impianti/{ImpiantoId}/files HTTP/1.1
Host: gemma.api.kerberos.energy
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
impiantoId: 0,
nome: String,
conflictAction: Error,
base64Content: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
fileId: 0,
finalFileName: String,
isUpdate: False,
responseStatus:
{
errorCode: String,
message: String,
stackTrace: String,
errors:
[
{
errorCode: String,
fieldName: String,
message: String,
meta:
{
String: String
}
}
],
meta:
{
String: String
}
}
}