Skip to content

feat: Instructor Dashboard - Add Certificates and generation history v2 api#38176

Open
wgu-jesse-stewart wants to merge 8 commits intoopenedx:masterfrom
WGU-Open-edX:wgu-jesse-stewart/instructor-certificates-list
Open

feat: Instructor Dashboard - Add Certificates and generation history v2 api#38176
wgu-jesse-stewart wants to merge 8 commits intoopenedx:masterfrom
WGU-Open-edX:wgu-jesse-stewart/instructor-certificates-list

Conversation

@wgu-jesse-stewart
Copy link
Contributor

@wgu-jesse-stewart wgu-jesse-stewart commented Mar 16, 2026

closes: #37916
closes: #37915

Description

This pull request adds new REST API endpoints to support certificate management functionality in the instructor dashboard, enabling the frontend to migrate to a micro-frontend architecture. The changes introduce four new API endpoints for viewing, regenerating, and configuring certificates.

Impact on User Roles:

  • Course Instructors/Staff: Will be able to access enhanced certificate management features through a new micro-frontend interface, including:

    • Viewing detailed certificate information with allowlist and invalidation status
    • Filtering certificates by various criteria (received, not received, audit passing/not passing, exceptions, invalidated)
    • Regenerating certificates for specific student sets or certificate statuses
    • Viewing certificate generation history
  • Developers: New API endpoints are available for integration with the instructor micro-frontend application

New API Endpoints:

  1. GET /api/instructor/v2/courses/{course_id}/certificates/issued - List issued certificates with filtering and search
  2. GET /api/instructor/v2/courses/{course_id}/certificates/generation_history - View certificate generation history
  3. POST /api/instructor/v2/courses/{course_id}/certificates/regenerate - Trigger certificate regeneration tasks
  4. GET /api/instructor/v2/courses/{course_id}/certificates/config - Check if certificate generation is enabled

Configuration Changes:

  • Adds INSTRUCTOR_MICROFRONTEND_URL configuration to devstack environment pointing to http://apps.local.openedx.io:2003

Supporting information

This change supports the migration of instructor dashboard functionality to a micro-frontend architecture, specifically for certificate management features.

Testing instructions

http://apps.local.openedx.io:8000/api-docs/#/instructor/instructor_v2_courses_certificates_issued_list

  1. Setup: Ensure you have a course with various certificate statuses (downloadable, notpassing, audit_passing, etc.)

  2. Test Issued Certificates Endpoint:
    List all certificates
    GET /api/instructor/v2/courses/{course_id}/certificates/issued

    Search by username
    GET /api/instructor/v2/courses/{course_id}/certificates/issued?search=student1

    Filter by status
    GET /api/instructor/v2/courses/{course_id}/certificates/issued?filter=received
    GET /api/instructor/v2/courses/{course_id}/certificates/issued?filter=granted_exceptions
    GET /api/instructor/v2/courses/{course_id}/certificates/issued?filter=audit_passing

  3. Test Certificate Generation History:
    GET /api/instructor/v2/courses/{course_id}/certificates/generation_history

  4. Test Certificate Regeneration:
    Regenerate specific statuses
    POST /api/instructor/v2/courses/{course_id}/certificates/regenerate
    Body: {"statuses": ["downloadable", "notpassing"]}

    Generate for allowlisted students
    POST /api/instructor/v2/courses/{course_id}/certificates/regenerate
    Body: {"student_set": "allowlisted"}

  5. Test Certificate Configuration:
    GET /api/instructor/v2/courses/{course_id}/certificates/config

  6. Verify Permissions: Ensure endpoints return 403 for users without instructor permissions
    Verify Pagination: Test pagination with page and page_size parameters on list endpoints

Deadline

None

Other information

  • Dependencies: This change is part of the instructor micro-frontend initiative and will be consumed by the frontend-app-instruct MFE
  • Backward Compatibility: These are new endpoints; no existing functionality is changed or deprecated
  • Performance Considerations: The IssuedCertificatesView performs multiple database queries (certificates, allowlist, invalidations, enrollments) and builds results in memory. For courses with very large enrollments, this may require optimization in future iterations
  • Debug Logging: Includes temporary debug logging in IssuedCertificatesView that may need to be removed or adjusted to appropriate log levels before production deployment

@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 Mar 16, 2026
@openedx-webhooks
Copy link

openedx-webhooks commented Mar 16, 2026

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.

Details
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.

@wgu-jesse-stewart wgu-jesse-stewart changed the title feat: 111 - Add Certificates tab with issued certificates and generation history feat: 111 - Add Certificates and generation history v2 api Mar 16, 2026
@wgu-jesse-stewart wgu-jesse-stewart changed the title feat: 111 - Add Certificates and generation history v2 api feat: Instructor Dashboard - Add Certificates and generation history v2 api Mar 16, 2026
@wgu-jesse-stewart wgu-jesse-stewart marked this pull request as ready for review March 16, 2026 21:48
@wgu-jesse-stewart wgu-jesse-stewart moved this from Needs Triage to Ready for Review in Contributions Mar 16, 2026
Copy link
Contributor

@brianjbuck-wgu brianjbuck-wgu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall a good start, I'd like to see a refactor to have the get_queryset() methods return querysets and then work on those querysets in separate methods. Also, I'd like to see some tests.

Comment on lines +1364 to +1399
def get_queryset(self):
"""
Returns the queryset of certificate generation history.
"""
from lms.djangoapps.certificates.models import CertificateGenerationHistory

course_id = self.kwargs["course_id"]
course_key = CourseKey.from_string(course_id)

# Validate that the course exists
get_course_by_id(course_key)

# Get generation history
history = CertificateGenerationHistory.objects.filter(
course_id=course_key
).select_related('generated_by', 'instructor_task').order_by('-created')

# Build result list
results = []
for entry in history:
# Determine task name
task_name = "Regenerated" if entry.is_regeneration else "Generated"

# Format date
date = entry.created.strftime("%B %d, %Y")

# Get details about what was generated/regenerated
details = str(entry.get_certificate_generation_candidates())

results.append({
'task_name': task_name,
'date': date,
'details': details,
})

return results
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also should also return a queryset instead of a list.

@wgu-jesse-stewart
Copy link
Contributor Author

Overall a good start, I'd like to see a refactor to have the get_queryset() methods return querysets and then work on those querysets in separate methods. Also, I'd like to see some tests.

Great feedback - thank you - I will work on this

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: Ready for Review

Development

Successfully merging this pull request may close these issues.

Instructor Dashboard - Certificates API - GET - Development Instructor Dashboard - Certificates API - GET - Schema

3 participants