Media Service API

The Media Service handles file uploads and image serving for the eTeamups Platform. It runs on internal port 9102 and is exposed through the gateway at the /media prefix.

Base paths:

Environment URL
Production https://api.zeswa.com/media
Local https://localhost:18443/media

Upload Limits

The Nginx gateway sets a maximum body size of 100 MB specifically for the /media location block (client_max_body_size 100M). This is higher than the default 50 MB limit applied to other services.


Endpoints

GET /media/media/:id

Retrieves a media file by its ID. Returns the binary file content with the appropriate Content-Type header.

Authentication: Required.

Path parameters

Parameter Type Description
id string The unique identifier of the media file.

Success response – 200 OK

The response body contains the raw binary file data. The Content-Type header is set according to the file’s MIME type (e.g., image/png, image/jpeg).

Error responses

Status Condition
401 Missing Authorization header.
403 Invalid or expired token.
404 Media file not found.
500 Internal server error.

Static File Serving

The Nginx gateway also serves static files directly from the /static path, which maps to the public/ directory on the server. These files are served with a one-year cache expiry and Cache-Control: public, immutable headers.

Production URL: https://api.zeswa.com/static/{filename}

This path does not require authentication and is handled entirely by Nginx without proxying to the Media Service.


Utility Endpoints

GET /media/health

Returns the health status of the Media Service.

Authentication: None required.

Success response – 200 OK

{
  "status": "ok"
}

GET /media/_ping

Lightweight liveness probe.

Authentication: None required.


Storage

In the production Docker deployment, uploaded media files are persisted in the media_uploads Docker volume, which is mounted at /app/uploads inside the Media Service container. This volume survives container restarts and updates.

The backup script (scripts/backup.sh) includes media files in its backup set by creating a tar archive of the volume contents.