diff --git a/frontend/src/components/integrations/integration-docs-content.tsx b/frontend/src/components/integrations/integration-docs-content.tsx index e12afc91..8436dcf5 100644 --- a/frontend/src/components/integrations/integration-docs-content.tsx +++ b/frontend/src/components/integrations/integration-docs-content.tsx @@ -50,10 +50,67 @@ function enrollmentExample(origin: string) { }'`; } +function progressExample(origin: string) { + return `curl -sS -G "${origin}/integrations/v1/progress" \\ + --data-urlencode "course_id=" \\ + --data-urlencode "learner_email=learner@example.com" \\ + -H "${INTEGRATION_ACCESS_KEY_HEADER}: " \\ + -H "${INTEGRATION_SECRET_KEY_HEADER}: "`; +} + +const PROGRESS_RESPONSE_EXAMPLE = `{ + "overall_progress": 50, + "completed_chapters": 1, + "total_chapters": 2, + "time_spent_seconds": 3600, + "current_chapter": { + "id": "chapter-b", + "title": "Chapter B", + "module_title": "Module 1", + "status": "IN_PROGRESS", + "progress": 25 + }, + "modules": [ + { + "id": "module-1", + "title": "Module 1", + "status": "IN_PROGRESS", + "progress_percent": 63, + "completed_chapters": 1, + "total_chapters": 2, + "chapters": [ + { + "id": "chapter-a", + "title": "Chapter A", + "status": "COMPLETED", + "completed": true, + "progress_percent": 100, + "blocks_completed": 4, + "blocks_total": 4, + "score": 8, + "max_score": 10, + "time_spent_seconds": 2400 + }, + { + "id": "chapter-b", + "title": "Chapter B", + "status": "IN_PROGRESS", + "completed": false, + "progress_percent": 25, + "blocks_completed": 1, + "blocks_total": 4, + "time_spent_seconds": 1200 + } + ] + } + ] +}`; + export function IntegrationDocsContent({ baseUrl }: { baseUrl: string }) { const origin = baseUrl.replace(/\/$/, ""); const connectionCurl = connectionExample(origin); const enrollCurl = enrollmentExample(origin); + const progressCurl = progressExample(origin); return (
@@ -188,6 +245,39 @@ export function IntegrationDocsContent({ baseUrl }: { baseUrl: string }) {
+
+

+ Read a learner's course progress +

+

+ Enroll the learner once, then request this report as they make progress. It includes every chapter in + their assigned course release, including chapters they have not started. Check each chapter's + status + and + completed + fields to show progress in your platform. The report is scoped to your organization's enrollment. +

+
+
+

Sample request

+ +
+
+                {progressCurl}
+              
+
+
+

Response fields

+
+                {PROGRESS_RESPONSE_EXAMPLE}
+              
+
+

+ The response also includes enrollment lifecycle, dates, review counts, course-level scores, and a + report timestamp. See docs/organization-api.mdx in the repository for the complete contract. +

+
+ ); diff --git a/frontend/src/lib/integration-api-catalog.ts b/frontend/src/lib/integration-api-catalog.ts index 908c9d86..a7c1e4f4 100644 --- a/frontend/src/lib/integration-api-catalog.ts +++ b/frontend/src/lib/integration-api-catalog.ts @@ -38,7 +38,7 @@ export const INTEGRATION_API_CATALOG = { path: "/integrations/v1/enrollments/cancel", description: "Cancel org enrollment (org_slug, email, course_id, optional user_id / mentor_id)", }, - { method: "GET", path: "/integrations/v1/progress", description: "Progress for org enrollment" }, + { method: "GET", path: "/integrations/v1/progress", description: "Read a learner report with module and chapter progress, completion, scores, and study time" }, { method: "GET", path: "/integrations/v1/course-requests",