| Required role: | ApiUser |
| POST | /documenti/{DocumentoId}/files | Carica un nuovo file associandolo a un'entità Documento. | ### Modalità di Upload supportate: 1. **Multipart/Form-Data (Raccomandato)**: Inviare il file binario nel corpo della richiesta (standard HTML form upload). In questa modalità, il campo `Nome` è opzionale: se omesso verrà usato il nome originale del file. 2. **JSON (Base64)**: Inviare un oggetto JSON contenente il campo `Base64Content`. Utile per integrazioni programmatiche dove il multipart non è agevole. **Logica Cartelle**: L'ID della cartella radice viene recuperato dal campo FileId dell'entità Documento. Se non esiste, viene creata implicitamente. |
|---|
| Name | Parameter | Data Type | Required | Description |
|---|---|---|---|---|
| DocumentoId | path | integer | Yes | ID univoco del Documento 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 .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /documenti/{DocumentoId}/files HTTP/1.1
Host: gemma.api.kerberos.energy
Accept: application/json
Content-Type: application/json
Content-Length: length
{"documentoId":0,"nome":"String","conflictAction":"Error","base64Content":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
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"}}}