GET /reports/scorm
GET /reports/scorm
GET /api/reports/scorm - SCORM activity report with pagination, filtering, and search Verify authentication with Clerk Get user's profile to determine role and tenant Verify user has access (instructor or admin) Parse query parameters First, get all SCORM activity IDs to filter efficiently Role-based filtering: instructors see only their courses Instructor has no courses, return empty result Apply course filter to SCORM activities If learning_activities table doesn't exist, return empty result Now query activity_progress for SCORM activities only Apply filters (course filter already applied to SCORM activities query above) Apply search filter (learner name or email) This requires a join, so we'll filter after fetching For now, we'll do a basic filter on user email/name via the join Note: Supabase doesn't support full-text search on joined tables easily We'll fetch and filter in memory for now, or use a more complex query Apply pagination and ordering All data is already SCORM-filtered, but verify activity exists Filter by search if provided (client-side filtering for now) Format response Extract time spent from tracking_data if available Calculate total: if search is applied, we need to fetch all matching records to get accurate count For now, we'll use the filtered count but note that pagination may not be accurate with search Search reduced results, but we don't have accurate total without fetching all Use a best-effort estimate: if current page has fewer results than limit, we're likely at the end
Endpoint
GET /reports/scorm
Authentication
This endpoint requires authentication. Include your authentication token in the request headers.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | string | Query parameter |
limit | string | Query parameter |
course | string | Query parameter |
dateFrom | string | Query parameter |
dateTo | string | Query parameter |
status | string | Query parameter |
search | string | Query parameter |
Error Responses
| Status Code | Error Code | Description |
|---|---|---|
| 401 | HTTP_401 | Unauthorized |
| 404 | HTTP_404 | Not Found |
| 403 | HTTP_403 | Forbidden |
| 500 | HTTP_500 | Internal Server Error |
| 500 | HTTP_500 | Internal Server Error |
Example Request
curl -X GET "https://api.allurelms.com/reports/scorm" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"