Config
Configuration Management
Endpoints for managing the general application configuration.
-
GET /config: Gets the current application configuration.- Authorization: None (public)
- cURL Example:
curl -X GET "http://127.0.0.1:9154/config"- Response Body (200 OK):
{"id": 1,"businessType": "store","businessName": "Ambrosia Restaurant","businessAddress": "123 Main Street, Anytown","businessPhone": "555-1234","businessEmail": "contact@ambrosia.com","businessTaxId": "ABC123456","businessLogoUrl": null,"businessTypeConfirmed": false}- Response Body (404 Not Found):
"Config not found" -
PUT /config: Updates the application configuration.- Authorization: Requires
settings_update
ImportantThis endpoint requires the complete configuration object to be sent. Omitting mandatory fields (
businessName,businessType) will result in a500 Internal Server Error.- Request Body:
{"businessType": "store","businessName": "string","businessAddress": "string (optional)","businessPhone": "string (optional)","businessEmail": "string (optional)","businessTaxId": "string (optional)","businessLogoUrl": "string (optional)","businessTypeConfirmed": false}- cURL Example:
curl -X PUT "http://127.0.0.1:9154/config" \-H "Cookie: accessToken=$ACCESS_TOKEN" \-H "Content-Type: application/json" \-d '{"businessType": "store","businessName": "Ambrosia Updated","businessAddress": "456 Oak Avenue, Anytown","businessPhone": "555-5678","businessEmail": "info@ambrosia.com","businessTaxId": "XYZ987654","businessLogoUrl": null,"businessTypeConfirmed": true}'- Response Body (200 OK):
{"message": "Config updated successfully"}- Response Body (404 Not Found):
"Failed to update config" - Authorization: Requires
File Uploads
-
POST /uploads: Uploads one or more files to the server (images, logos, etc.).- Authorization: Requires access token if the system is already initialized. Open during initial setup.
- Content-Type:
multipart/form-data - cURL Example:
curl -X POST "http://127.0.0.1:9154/uploads" \-H "Cookie: accessToken=$ACCESS_TOKEN" \-F "file=@/path/to/logo.png"- Response Body (201 Created):
{"uploads": [{"path": "/uploads/logo.png","url": "http://127.0.0.1:9154/uploads/logo.png"}]}- Response Body (400 Bad Request): no file sent
{ "message": "No files uploaded" } -
GET /uploads/{filename}: Accesses a previously uploaded file.- Authorization: No authentication required (static files)
- cURL Example:
curl -X GET "http://127.0.0.1:9154/uploads/logo.png"
Currencies
-
GET /currencies: Lists all available currencies in the system.- Authorization: Requires
settings_read - cURL Example:
curl -X GET "http://127.0.0.1:9154/currencies" \-H "Cookie: accessToken=$ACCESS_TOKEN"- Response Body (200 OK):
[{ "id": "1", "name": "US Dollar", "acronym": "USD", "symbol": "$" },{ "id": "2", "name": "Euro", "acronym": "EUR", "symbol": "€" }] - Authorization: Requires
-
GET /base-currency: Gets the base currency configured for the business.- Authorization: Requires
settings_read
Known BugThere is a duplicate implementation in
Routing.ktthat responds200 { "currency_id": null }when no base currency is set. The correct behavior (documented here) is fromCurrency.kt. Issue reported to the backend team.- cURL Example:
curl -X GET "http://127.0.0.1:9154/base-currency" \-H "Cookie: accessToken=$ACCESS_TOKEN"- Response Body (200 OK):
{ "id": "1", "name": "US Dollar", "acronym": "USD", "symbol": "$" }- Response Body (404 Not Found): base currency not configured
{ "message": "Base currency not set" } - Authorization: Requires
-
PUT /base-currency: Sets the base currency by acronym.- Authorization: Requires
settings_update - Request Body:
{ "acronym": "USD" }- cURL Example:
curl -X PUT "http://127.0.0.1:9154/base-currency" \-H "Cookie: accessToken=$ACCESS_TOKEN" \-H "Content-Type: application/json" \-d '{ "acronym": "USD" }'- Response Body (200 OK):
{ "id": "1", "name": "US Dollar", "acronym": "USD", "symbol": "$" }- Response Body (400 Bad Request): blank or missing acronym
{ "message": "Acronym is required" }- Response Body (404 Not Found): unknown acronym
{ "message": "Unknown currency acronym: XYZ" } - Authorization: Requires