Merge pull request #5491 from edx/markhoeber-doc989

WIP: edX Mobile API Doc
This commit is contained in:
Mark Hoeber
2014-10-20 09:26:27 -04:00
20 changed files with 1173 additions and 12 deletions

View File

@@ -13,10 +13,27 @@ from xmodule.modulestore.django import modulestore
class CourseUpdatesList(generics.ListAPIView):
"""Notes:
"""
**Use Case**
1. This only works for new-style course updates and is not the older freeform
format.
Get the content for course updates.
**Example request**:
GET /api/mobile/v0.5/course_info/{organization}/{course_number}/{course_run}/updates
**Response Values**
A array of course updates. Each course update contains:
* date: The date of the course update.
* content: The content, as a string, of the course update. HTML tags
are not included in the string.
* status: Whether the update is visible or not.
* id: The unique identifier of the update.
"""
authentication_classes = (OAuth2Authentication, SessionAuthentication)
permission_classes = (permissions.IsAuthenticated,)
@@ -33,7 +50,18 @@ class CourseUpdatesList(generics.ListAPIView):
class CourseHandoutsList(generics.ListAPIView):
"""Please just render this in an HTML view for now.
"""
**Use Case**
Get the HTML for course handouts.
**Example request**:
GET /api/mobile/v0.5/course_info/{organization}/{course_number}/{course_run}/handouts
**Response Values**
* handouts_html: The HTML for course handouts.
"""
authentication_classes = (OAuth2Authentication, SessionAuthentication)
permission_classes = (permissions.IsAuthenticated,)
@@ -52,7 +80,17 @@ class CourseHandoutsList(generics.ListAPIView):
class CourseAboutDetail(generics.RetrieveAPIView):
"""
Renders course 'about' page
**Use Case**
Get the HTML for the course about page.
**Example request**:
GET /api/mobile/v0.5/course_info/{organization}/{course_number}/{course_run}/about
**Response Values**
* overview: The HTML for the course About page.
"""
authentication_classes = (OAuth2Authentication, SessionAuthentication)
permission_classes = (permissions.IsAuthenticated,)

View File

@@ -23,10 +23,33 @@ class IsUser(permissions.BasePermission):
class UserDetail(generics.RetrieveAPIView):
"""Read-only information about our User.
"""
**Use Case**
This will be where users are redirected to after API login and will serve
as a place to list all useful resources this user can access.
Get information about the specified user and
access other resources the user has permissions for.
Users are redirected to this endpoint after logging in.
You can use the **course_enrollments** value in
the response to get a list of courses the user is enrolled in.
**Example request**:
GET /api/mobile/v0.5/users/{username}
**Response Values**
* id: The ID of the user.
* username: The username of the currently logged in user.
* email: The email address of the currently logged in user.
* name: The full name of the currently logged in user.
* course_enrollments: The URI to list the courses the currently logged
in user is enrolled in.
"""
authentication_classes = (OAuth2Authentication, SessionAuthentication)
permission_classes = (permissions.IsAuthenticated, IsUser)
@@ -39,7 +62,38 @@ class UserDetail(generics.RetrieveAPIView):
class UserCourseEnrollmentsList(generics.ListAPIView):
"""Read-only list of courses that this user is enrolled in."""
"""
**Use Case**
Get information about the courses the currently logged in user is
enrolled in.
**Example request**:
GET /api/mobile/v0.5/users/{username}/course_enrollments/
**Response Values**
* created: The date the course was created.
* mode: The type of certificate registration for this course: honor or
certified.
* is_active: Whether the course is currently active; true or false.
* course: A collection of data about the course:
* course_about: The URI to get the data for the course About page.
* course_updates: The URI to get data for course updates.
* number: The course number.
* org: The organization that created the course.
* video_outline: The URI to get the list of all vides the user can
access in the course.
* id: The unique ID of the course.
* latest_updates: Reserved for future use.
* end: The end date of the course.
* name: The name of the course.
* course_handouts: The URI to get data for course handouts.
* start: The data and time the course starts.
* course_image: The path to the course image.
"""
authentication_classes = (OAuth2Authentication, SessionAuthentication)
permission_classes = (permissions.IsAuthenticated, IsUser)
queryset = CourseEnrollment.objects.all()

View File

@@ -25,7 +25,58 @@ from .serializers import BlockOutline, video_summary
class VideoSummaryList(generics.ListAPIView):
"""A list of all Videos in this Course that the user has access to."""
"""
**Use Case**
Get a list of all videos in the specified course. You can use the
video_url value to access the video file.
**Example request**:
GET /api/mobile/v0.5/video_outlines/courses/{organization}/{course_number}/{course_run}
**Response Values**
An array of videos in the course. For each video:
* section_url: The URL to the first page of the section that
contains the video in the Learning Managent System.
* path: An array containing category and name values specifying the
complete path the the video in the courseware hierarcy. The
following categories values are included: "chapter", "sequential",
and "vertical". The name value is the display name for that object.
* unit_url: The URL to the unit contains the video in the Learning
Managent System.
* named_path: An array consisting of the display names of the
courseware objects in the path to the video.
* summary: An array of data about the video that includes:
* category: The type of component, in this case always "video".
* video_thumbnail_url: The URL to the thumbnail image for the
video, if available.
* language: The language code for the video.
* name: The display name of the video.
* video_url: The URL to the video file. Use this value to access
the video.
* duration: The length of the video, if available.
* transcripts: An array of language codes and URLs to available
video transcripts. Use the URL value to access a transcript
for the video.
* id: The unique identifier for the video.
* size: The size of the video file
"""
authentication_classes = (OAuth2Authentication, SessionAuthentication)
permission_classes = (permissions.IsAuthenticated,)
@@ -45,9 +96,19 @@ class VideoSummaryList(generics.ListAPIView):
class VideoTranscripts(generics.RetrieveAPIView):
"""Read-only view for a single transcript (SRT) file for a particular language.
"""
**Use Case**
Use to get a transcript for a specified video and language.
**Example request**:
GET /api/mobile/v0.5/video_outlines/transcripts/{organization}/{course_number}/{course_run}/{video ID}/{language code}
**Response Values**
An HttpResponse with an SRT file download.
Returns an `HttpResponse` with an SRT file download for the body.
"""
authentication_classes = (OAuth2Authentication, SessionAuthentication)
permission_classes = (permissions.IsAuthenticated,)