# WebAPI Simple web application created using DTLib.Web. ## Important Restart web application once per day to delete outdated data and clean RAM. ## Config `SaveUpload` section of `config.json`: - `MaxSizeCompressedBytes` - max size of uploaded `.tar.zst` (default 60 MiB) - `MaxSizePlainTextBytes` - max size of the game data entry after decompression (default 200 MiB) ## Routes ### POST `/uploadSave` - **Query Params:** - `game` - short name of the game (see [../README.md](../README.md)) - `originalFileType` - `text` | `zip` - `originalFileName` - name of the original save file (max 255 characters) - **Request Body:** `application/zstd` - single zstd frame containing a tar with files of the original save. Game data is read from the entry named in [GameSaveEntryNames](./Game.cs) (`gamestate` for EU4). A plain text save is a tar with just that one entry. The blob is stored byte-for-byte and can be downloaded with `/getSaveFile`. - **Response:** ```json { "id": "string" } ``` or `{ "errorMessage": "string" }` (status 413 if upload or uncompressed game data exceeds the limits from config) ### GET `/getSaveStatus` - **Query Params:** - `id` - id of uploaded save file - **Response:** [SaveFileMetadata](./Database/SaveFileMetadata.cs) ```json { "id": "string", "game": "string", "status": "initialized | uploaded | parsing | saving_results | done | error", "uploadDateTime": "string", "originalFileType": "text | zip", "originalFileName": "string", "errorMessage": "string?" } ``` ### GET `/getSaveFile` - **Query Params:** - `id` - id of uploaded save file - **Response:** `application/zstd` - uploaded blob, unchanged or `{ "errorMessage": "string" }` ### GET `/getSaveData` - **Query Params:** - `id` - id of uploaded save file - **Response:** ```json5 { "key0": [ "objects" ], "key1": [ "objects" ], //... } ``` or `{ "errorMessage": "string" }`