lms.djangoapps.certificates.apis.v0 package#
Submodules#
lms.djangoapps.certificates.apis.v0.permissions module#
This module provides a custom DRF Permission class for supporting the course certificates to Admin users and users whom they belongs to.
lms.djangoapps.certificates.apis.v0.urls module#
Certificates API v0 URLs.
lms.djangoapps.certificates.apis.v0.views module#
API v0 views.
- class lms.djangoapps.certificates.apis.v0.views.CertificatesDetailView(**kwargs)#
Bases:
APIViewUse Case
Get the details of a certificate for a specific user in a course.
Example Request
GET /api/certificates/v0/certificates/{username}/courses/{course_id}
GET Parameters
A GET request must include the following parameters.
username: A string representation of an user’s username.
course_id: A string representation of a Course ID.
GET Response Values
If the request for information about the Certificate is successful, an HTTP 200 “OK” response is returned.
The HTTP 200 response has the following values.
username: A string representation of an user’s username passed in the request.
course_id: A string representation of a Course ID.
- certificate_type: A string representation of the certificate type.
Can be honor|verified|professional
created_date: Date/time the certificate was created, in ISO-8661 format.
status: A string representation of the certificate status.
is_passing: True if the certificate has a passing status, False if not.
download_url: A string representation of the certificate url.
grade: A string representation of a float for the user’s course grade.
Example GET Response
- {
“username”: “bob”, “course_id”: “edX/DemoX/Demo_Course”, “certificate_type”: “verified”, “created_date”: “2015-12-03T13:14:28+0000”, “status”: “downloadable”, “is_passing”: true, “download_url”: “http://www.example.com/cert.pdf”, “grade”: “0.98”
}
- authentication_classes = (<class 'edx_rest_framework_extensions.auth.jwt.authentication.JwtAuthentication'>, <class 'openedx.core.lib.api.authentication.BearerAuthenticationAllowInactiveUser'>, <class 'edx_rest_framework_extensions.auth.session.authentication.SessionAuthenticationAllowInactiveUser'>)#
- get(request, username, course_id)#
Retrieves certificate information for a user in a specified course run.
- Parameters:
request (Request) – Django request object.
username (string) – URI element specifying the user’s username.
course_id (string) – URI element specifying the course location.
- Returns:
A JSON serialized representation of the certificate.
- permission_classes = (<rest_framework.permissions.OperandHolder object>,)#
- required_scopes = ['certificates:read']#
- class lms.djangoapps.certificates.apis.v0.views.CertificatesListView(**kwargs)#
Bases:
APIViewREST API endpoints for listing certificates.
- authentication_classes = (<class 'edx_rest_framework_extensions.auth.jwt.authentication.JwtAuthentication'>, <class 'openedx.core.lib.api.authentication.BearerAuthenticationAllowInactiveUser'>, <class 'edx_rest_framework_extensions.auth.session.authentication.SessionAuthenticationAllowInactiveUser'>)#
- get(request, username)#
Get a paginated list of certificates for a user.
Use Case
Get the list of viewable course certificates for a specific user.
Example Request
GET /api/certificates/v0/certificates/{username}
GET Response Values
If the request for information about the user’s certificates is successful, an HTTP 200 “OK” response is returned.
The HTTP 200 response contains a list of dicts with the following keys/values.
username: A string representation of an user’s username passed in the request.
course_id: A string representation of a Course ID.
course_display_name: A string representation of the Course name.
course_organization: A string representation of the organization associated with the Course.
- certificate_type: A string representation of the certificate type.
Can be honor|verified|professional
created_date: Date/time the certificate was created, in ISO-8661 format.
status: A string representation of the certificate status.
is_passing: True if the certificate has a passing status, False if not.
download_url: A string representation of the certificate url.
grade: A string representation of a float for the user’s course grade.
Example GET Response
- [{
“username”: “bob”, “course_id”: “edX/DemoX/Demo_Course”, “certificate_type”: “verified”, “created_date”: “2015-12-03T13:14:28+0000”, “status”: “downloadable”, “is_passing”: true, “download_url”: “http://www.example.com/cert.pdf”, “grade”: “0.98”
}]
- permission_classes = (<rest_framework.permissions.OperandHolder object>, <rest_framework.permissions.OperandHolder object>)#
- required_scopes = ['certificates:read']#