# CentralDB API Specification This document specifies the API endpoints provided by the CentralDB for the FitTrack Report Generator. ## Endpoints ### Activities - **`GET /activities/{activity_id}/file`**: Downloads the FIT file for a given activity. - **`POST /activities/{activity_id}/analysis`**: Creates an analysis artifact for an activity. - **Request Body**: `AnalysisArtifactCreate` - **`GET /activities/{activity_id}/analysis`**: Retrieves an analysis artifact for an activity. - **Response Body**: `AnalysisArtifact` - **`POST /activities/{activity_id}/analysis/charts`**: Uploads a chart for an analysis. - **Request Body**: `multipart/form-data` with `chart_type` and `file`. - **`GET /activities/{activity_id}/analysis/charts/{chart_type}`**: Retrieves a chart for an analysis. ## Schemas ### AnalysisArtifactCreate ```json { "properties": { "data": { "additionalProperties": true, "type": "object", "title": "Data" } }, "type": "object", "required": [ "data" ], "title": "AnalysisArtifactCreate" } ``` ### AnalysisArtifact ```json { "properties": { "activity_id": { "type": "integer", "title": "Activity Id" }, "data": { "additionalProperties": true, "type": "object", "title": "Data" }, "id": { "type": "integer", "title": "Id" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" } }, "type": "object", "required": [ "activity_id", "data", "id", "created_at" ], "title": "AnalysisArtifact" } ``` ### Chart ```json { "properties": { "id": { "type": "integer", "title": "Id" }, "activity_id": { "type": "integer", "title": "Activity Id" }, "chart_type": { "type": "string", "title": "Chart Type" }, "file_path": { "type": "string", "title": "File Path" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" } }, "type": "object", "required": [ "id", "activity_id", "chart_type", "file_path", "created_at" ], "title": "Chart" } ```