Skip to content

feat: 37468/add REST API endpoints for instructor dashboard data downloads#37984

Draft
wgu-jesse-stewart wants to merge 7 commits intoopenedx:masterfrom
WGU-Open-edX:wgu-jesse-stewart/37468-datadownloads-get-api
Draft

feat: 37468/add REST API endpoints for instructor dashboard data downloads#37984
wgu-jesse-stewart wants to merge 7 commits intoopenedx:masterfrom
WGU-Open-edX:wgu-jesse-stewart/37468-datadownloads-get-api

Conversation

@wgu-jesse-stewart
Copy link
Contributor

@wgu-jesse-stewart wgu-jesse-stewart commented Feb 5, 2026

Issue #37468

Description

This PR adds REST API endpoints to support programmatic access to the Instructor Dashboard's data download functionality. It introduces two new v2 API endpoints that allow instructors to list available report downloads and trigger report generation for their courses.

Changes:

  • GET /api/instructor/v2/courses/{course_id}/reports - Lists all available report downloads for a course with metadata (filename, URL, type, date generated)
  • POST /api/instructor/v2/courses/{course_id}/reports/{report_type}/generate - Triggers generation of a specific report type

Supported Report Types:

  • enrolled_students - Student profile and enrollment data
  • pending_enrollments - Users allowed to enroll but haven't yet
  • pending_activations - Inactive users with enrollments
  • anonymized_student_ids - Anonymized student ID mapping
  • grade - Course grade report
  • problem_grade - Problem-level grade report
  • problem_responses - Student responses to problems
  • ora2_summary - Open Response Assessment summary
  • ora2_data - ORA detailed data export
  • ora2_submission_files - ORA submission file archives
  • issued_certificates - Certificate issuance data

User Roles Impacted:

  • Instructors/Course Staff - Can now programmatically access data downloads via API
  • Developers - Can integrate course data exports into external systems

Supporting information

Related to ticket #37468

Testing instructions

  1. Setup: Ensure you have instructor access to a course with existing data

  2. Test GET endpoint:

    curl -X GET "http://localhost:18000/api/instructor/v2/courses/{course_id}/reports" \
      -H "Authorization: Bearer {token}"

    Expected: Returns JSON array of available downloads with metadata

  3. Test POST endpoint (generate grade report):

    curl -X POST "http://localhost:18000/api/instructor/v2/courses/{course_id}/reports/grade/generate" \
      -H "Authorization: Bearer {token}"

    Expected: Returns success message indicating report generation started

  4. Test Problem Responses with specific problem:

    curl -X POST "http://localhost:18000/api/instructor/v2/courses/{course_id}/reports/problem_responses/generate" \
      -H "Authorization: Bearer {token}" \
      -H "Content-Type: application/json" \
      -d '{"problem_location": "block-v1:..."}'
  5. Verify report detection: Check that existing reports in storage are correctly categorized by type

  6. Test error cases:

    • Invalid course ID (expect 404)
    • Invalid report type (expect 400)
    • Non-instructor user (expect 403)

Other information

  • These endpoints use existing instructor task infrastructure - no new background task types required
  • Report storage uses the existing ReportStore configured via GRADES_DOWNLOAD
  • The issued_certificates report is generated synchronously (small dataset), all others are async tasks
  • GenerateReportView uses @method_decorator(transaction.non_atomic_requests) to allow async task submission
  • New ReportType enum added to instructor_task/data.py for consistent report type identifiers
  • Report type detection from filenames uses pattern matching (most specific patterns checked first)

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Feb 5, 2026
@openedx-webhooks
Copy link

Thanks for the pull request, @wgu-jesse-stewart!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

2 participants