Client Lambda API¶
The browser calls the lambda-resize HTTP API for operations that require video or frame access. Flask owns HTML and metadata APIs; lambda-resize owns first frame extraction, playback URL generation, and retracing.
See ArchitectureDesign.md for the current service boundary.
Lambda API Base URL¶
Flask injects the Lambda API base URL into pages as the browser global
LAMBDA_API_BASE.
Template:
src/app/templates/base.htmlServer:
src/app/apikey.py, viaget_lambda_api_base()Local override:
PLANTTRACER_LAMBDA_API_BASE=http://127.0.0.1:9811/Deployed fallback:
https://{HOSTNAME}-lambda.{DOMAIN}/
All client calls are authorized. The browser sends the current api_key; the
Lambda validates it against DynamoDB.
Endpoints¶
Operation |
Method |
Path |
Auth |
Purpose |
|---|---|---|---|---|
Ping |
GET |
|
none |
Health check; returns |
First frame |
GET |
|
query |
Returns JPEG frame 0 with saved rotation applied and scaled to the analysis size. |
Movie data |
GET |
|
query |
Returns signed playback/download URLs as JSON. |
Movie data redirect |
GET |
|
query |
302 redirect to signed movie URL. |
Movie zip redirect |
GET |
|
query |
302 redirect to signed frame ZIP URL if present. |
Trace movie |
POST |
|
|
Queues retracing from a user-edited source frame through an optional end frame. |
Compatibility route:
GET /api/v1/movie-datacalls the same handler as/resize-api/v1/movie-data.
Trace Movie Request¶
POST /resize-api/v1/trace-movie
Headers:
x-api-key: <api_key>
Content-Type: application/json
Body:
{ "movie_id": "m...", "frame_start": 12, "frame_end": 200 }
frame_start is the edited source frame. Plant Tracer preserves that frame,
clears stored trackpoints after it through frame_end when supplied, marks the
movie as tracing, and queues work. In local mode the work goes to the
in-process queue; in deployed mode it goes to SQS through TRACING_QUEUE_URL.
Local Development¶
Use the Makefile instead of hand-built commands:
make run-local-lambda-debug
make run-local-debug
run-local-lambda-debug starts a Flask bridge that converts local HTTP requests
into API Gateway v2 events and calls resize_app.main.lambda_handler().