Enrollment API Doc
This commit is contained in:
@@ -21,7 +21,45 @@ class EnrollmentUserThrottle(UserRateThrottle):
|
||||
|
||||
|
||||
class EnrollmentView(APIView):
|
||||
""" Enrollment API View for creating, updating, and viewing course enrollments. """
|
||||
"""
|
||||
**Use Cases**
|
||||
|
||||
Get the user's enrollment status for a course.
|
||||
|
||||
**Example Requests**:
|
||||
|
||||
GET /api/enrollment/v1/enrollment/{user_id},{course_id}
|
||||
|
||||
**Response Values**
|
||||
|
||||
* created: The date the user account was created.
|
||||
|
||||
* mode: The enrollment mode of the user in this course.
|
||||
|
||||
* is_active: Whether the enrollment is currently active.
|
||||
|
||||
* course_details: A collection that includes:
|
||||
|
||||
* course_id: The unique identifier for the course.
|
||||
|
||||
* enrollment_end: The date and time after which users cannot enroll for the course.
|
||||
|
||||
* course_modes: An array of data about the enrollment modes supported for the course. Each enrollment mode collection includes:
|
||||
|
||||
* slug: The short name for the enrollment mode.
|
||||
* name: The full name of the enrollment mode.
|
||||
* min_price: The minimum price for which a user can enroll in this mode.
|
||||
* suggested_prices: A list of suggested prices for this enrollment mode.
|
||||
* currency: The currency of the listed prices.
|
||||
* expiration_datetime: The date and time after which users cannot enroll in the course in this mode.
|
||||
* description: A description of this mode.
|
||||
|
||||
* enrollment_start: The date and time that users can begin enrolling in the course.
|
||||
|
||||
* invite_only: Whether students must be invited to enroll in the course; true or false.
|
||||
|
||||
* user: The ID of the user.
|
||||
"""
|
||||
|
||||
authentication_classes = OAuth2Authentication, SessionAuthenticationAllowInactiveUser
|
||||
permission_classes = permissions.IsAuthenticated,
|
||||
@@ -63,7 +101,40 @@ class EnrollmentView(APIView):
|
||||
|
||||
|
||||
class EnrollmentCourseDetailView(APIView):
|
||||
""" Enrollment API View for viewing course enrollment details. """
|
||||
"""
|
||||
**Use Cases**
|
||||
|
||||
Get enrollment details for a course.
|
||||
|
||||
**Note:** Getting enrollment details for a course does not require authentication.
|
||||
|
||||
**Example Requests**:
|
||||
|
||||
GET /api/enrollment/v1/course/{course_id}
|
||||
|
||||
|
||||
**Response Values**
|
||||
|
||||
A collection of course enrollments for the user, or for the newly created enrollment. Each course enrollment contains:
|
||||
|
||||
* course_id: The unique identifier of the course.
|
||||
|
||||
* enrollment_end: The date and time after which users cannot enroll for the course.
|
||||
|
||||
* course_modes: An array of data about the enrollment modes supported for the course. Each enrollment mode collection includes:
|
||||
|
||||
* slug: The short name for the enrollment mode.
|
||||
* name: The full name of the enrollment mode.
|
||||
* min_price: The minimum price for which a user can enroll in this mode.
|
||||
* suggested_prices: A list of suggested prices for this enrollment mode.
|
||||
* currency: The currency of the listed prices.
|
||||
* expiration_datetime: The date and time after which users cannot enroll in the course in this mode.
|
||||
* description: A description of this mode.
|
||||
|
||||
* enrollment_start: The date and time that users can begin enrolling in the course.
|
||||
|
||||
* invite_only: Whether students must be invited to enroll in the course; true or false.
|
||||
"""
|
||||
|
||||
authentication_classes = []
|
||||
permission_classes = []
|
||||
@@ -98,24 +169,71 @@ class EnrollmentCourseDetailView(APIView):
|
||||
|
||||
|
||||
class EnrollmentListView(APIView):
|
||||
""" Enrollment API List View for viewing all course enrollments for a user. """
|
||||
"""
|
||||
**Use Cases**
|
||||
|
||||
1. Get a list of all course enrollments for the currently logged in user.
|
||||
|
||||
2. Enroll the currently logged in user in a course.
|
||||
|
||||
Currently you can use this command only to enroll the user in "honor" mode.
|
||||
|
||||
If honor mode is not supported for the course, the request fails and returns the available modes.
|
||||
|
||||
**Example Requests**:
|
||||
|
||||
GET /api/enrollment/v1/enrollment
|
||||
|
||||
POST /api/enrollment/v1/enrollment{"course_details":{"course_id": "edX/DemoX/Demo_Course"}}
|
||||
|
||||
**Post Parameters**
|
||||
|
||||
* user: The user ID of the currently logged in user. Optional. You cannot use the command to enroll a different user.
|
||||
|
||||
* course details: A collection that contains:
|
||||
|
||||
* course_id: The unique identifier for the course.
|
||||
|
||||
**Response Values**
|
||||
|
||||
A collection of course enrollments for the user, or for the newly created enrollment. Each course enrollment contains:
|
||||
|
||||
* created: The date the user account was created.
|
||||
|
||||
* mode: The enrollment mode of the user in this course.
|
||||
|
||||
* is_active: Whether the enrollment is currently active.
|
||||
|
||||
* course_details: A collection that includes:
|
||||
|
||||
* course_id: The unique identifier for the course.
|
||||
|
||||
* enrollment_end: The date and time after which users cannot enroll for the course.
|
||||
|
||||
* course_modes: An array of data about the enrollment modes supported for the course. Each enrollment mode collection includes:
|
||||
|
||||
* slug: The short name for the enrollment mode.
|
||||
* name: The full name of the enrollment mode.
|
||||
* min_price: The minimum price for which a user can enroll in this mode.
|
||||
* suggested_prices: A list of suggested prices for this enrollment mode.
|
||||
* currency: The currency of the listed prices.
|
||||
* expiration_datetime: The date and time after which users cannot enroll in the course in this mode.
|
||||
* description: A description of this mode.
|
||||
|
||||
* enrollment_start: The date and time that users can begin enrolling in the course.
|
||||
|
||||
* invite_only: Whether students must be invited to enroll in the course; true or false.
|
||||
|
||||
* user: The ID of the user.
|
||||
"""
|
||||
|
||||
authentication_classes = OAuth2Authentication, SessionAuthenticationAllowInactiveUser
|
||||
permission_classes = permissions.IsAuthenticated,
|
||||
throttle_classes = EnrollmentUserThrottle,
|
||||
|
||||
def get(self, request):
|
||||
"""List out all the enrollments for the current user
|
||||
|
||||
Returns a JSON response with all the course enrollments for the current user.
|
||||
|
||||
Args:
|
||||
request (Request): The GET request for course enrollment listings.
|
||||
user (str): Get all enrollments for the specified user's username.
|
||||
|
||||
Returns:
|
||||
A JSON serialized representation of the user's course enrollments.
|
||||
|
||||
"""
|
||||
Gets a list of all course enrollments for the currently logged in user.
|
||||
"""
|
||||
user = request.GET.get('user', request.user.username)
|
||||
if request.user.username != user:
|
||||
@@ -135,25 +253,8 @@ class EnrollmentListView(APIView):
|
||||
)
|
||||
|
||||
def post(self, request):
|
||||
"""Create a new enrollment
|
||||
|
||||
Creates a new enrollment based on the data posted. Currently all that can be specified is
|
||||
the course id. All other attributes will be determined by the server, and cannot be updated
|
||||
through this endpoint.
|
||||
|
||||
By default, this will attempt to create the enrollment with course mode 'honor'. If the course
|
||||
does not have an 'honor' course mode, it will fail as a bad request and list the available
|
||||
course modes.
|
||||
|
||||
Args:
|
||||
request (Request): The POST request to create a new enrollment. POST DATA should contain
|
||||
'course_details' with an attribute 'course_id' to identify which course to enroll in.
|
||||
'user' may be specified as well, but must match the username of the authenticated user.
|
||||
Ex. {'user': 'Bob', 'course_details': { 'course_id': 'edx/demo/T2014' } }
|
||||
|
||||
Returns:
|
||||
A JSON serialized representation of the user's new course enrollment.
|
||||
|
||||
"""
|
||||
Enrolls the currently logged in user in a course.
|
||||
"""
|
||||
user = request.DATA.get('user', request.user.username)
|
||||
if not user:
|
||||
|
||||
10
common/test/data/test_unicode/static/unicø∂é.txt
Normal file
10
common/test/data/test_unicode/static/unicø∂é.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
Upside down unicode text (http://www.sunnyneo.com/upsidedowntext.php?)
|
||||
|
||||
˙ʇʇɐld uoɯəl plos əɥs ˙pəʌıl əuɹʎq ʎʇʇəq əɹəɥʍ pɐoɹ əɥʇ uʍop əɯɐɔ ʍoɔ-ooɯ əɥʇ
|
||||
˙ooʞɔnʇ ʎqɐq sɐʍ əɥ ˙əɔɐɟ ʎɹıɐɥ ɐ pɐɥ əɥ :ssɐlƃ ɐ ɥƃnoɹɥʇ ɯıɥ ʇɐ pəʞool ɹəɥʇɐɟ
|
||||
sıɥ :ʎɹoʇs ʇɐɥʇ ɯıɥ ploʇ ɹəɥʇɐɟ sıɥ
|
||||
|
||||
˙˙˙ooʞɔnʇ ʎqɐq pəɯɐu ʎoq əlʇʇıl suəɔıu ɐ ʇəɯ pɐoɹ əɥʇ ƃuolɐ uʍop ƃuıɯoɔ sɐʍ ʇɐɥʇ
|
||||
ʍoɔ-ooɯ sıɥʇ puɐ pɐoɹ əɥʇ ƃuolɐ uʍop ƃuıɯoɔ ʍoɔ-ooɯ ɐ sɐʍ əɹəɥʇ sɐʍ ʇı əɯıʇ pooƃ
|
||||
ʎɹəʌ ɐ puɐ əɯıʇ ɐ uodn əɔuo
|
||||
164
docs/en_us/enrollment_api/Makefile
Normal file
164
docs/en_us/enrollment_api/Makefile
Normal file
@@ -0,0 +1,164 @@
|
||||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS ?=
|
||||
SPHINXBUILD ?= sphinx-build
|
||||
PAPER ?=
|
||||
BUILDDIR ?= build
|
||||
|
||||
# User-friendly check for sphinx-build
|
||||
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
||||
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
||||
endif
|
||||
|
||||
Q_FLAG =
|
||||
|
||||
ifeq ($(quiet), true)
|
||||
Q_FLAG = -Q
|
||||
endif
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = $(Q_FLAG) -d $(BUILDDIR)/doctrees -c source $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " singlehtml to make a single large HTML file"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " devhelp to make HTML files and a Devhelp project"
|
||||
@echo " epub to make an epub"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||
@echo " text to make text files"
|
||||
@echo " man to make manual pages"
|
||||
@echo " texinfo to make Texinfo files"
|
||||
@echo " info to make Texinfo files and run them through makeinfo"
|
||||
@echo " gettext to make PO message catalogs"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
|
||||
clean:
|
||||
-rm -rf $(BUILDDIR)/*
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
singlehtml:
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/edX.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/edX.qhc"
|
||||
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@echo "To view the help file:"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/edX"
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/edX"
|
||||
@echo "# devhelp"
|
||||
|
||||
epub:
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||
"(use \`make latexpdf' here to do that automatically)."
|
||||
|
||||
latexpdf:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
text:
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||
@echo
|
||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||
|
||||
man:
|
||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||
@echo
|
||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||
|
||||
texinfo:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo
|
||||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
info:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C $(BUILDDIR)/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||
|
||||
gettext:
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
||||
0
docs/en_us/enrollment_api/__init__.py
Normal file
0
docs/en_us/enrollment_api/__init__.py
Normal file
9
docs/en_us/enrollment_api/requirements.txt
Normal file
9
docs/en_us/enrollment_api/requirements.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
path.py
|
||||
Django >=1.4,<1.5
|
||||
pytz
|
||||
-e git+https://github.com/edx/XBlock.git#egg=XBlock
|
||||
lxml
|
||||
sphinxcontrib-napoleon==0.2.6
|
||||
stevedore==0.14.1
|
||||
djangorestframework==2.3.14
|
||||
PyYAML>=3.10
|
||||
0
docs/en_us/enrollment_api/source/__init__.py
Normal file
0
docs/en_us/enrollment_api/source/__init__.py
Normal file
BIN
docs/en_us/enrollment_api/source/_static/homepage-bg.jpg
Normal file
BIN
docs/en_us/enrollment_api/source/_static/homepage-bg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 157 KiB |
5
docs/en_us/enrollment_api/source/_templates/layout.html
Normal file
5
docs/en_us/enrollment_api/source/_templates/layout.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{% extends "!layout.html" %}
|
||||
|
||||
{% block header %}
|
||||
<img src="{{ pathto("_static/homepage-bg.jpg", 1) }}" alt="Edx logo" width="100%;"/>
|
||||
{% endblock %}
|
||||
41
docs/en_us/enrollment_api/source/authentication.rst
Normal file
41
docs/en_us/enrollment_api/source/authentication.rst
Normal file
@@ -0,0 +1,41 @@
|
||||
.. _edX API Authentication:
|
||||
|
||||
##################################
|
||||
edX Enrollment API Authentication
|
||||
##################################
|
||||
|
||||
You have two options for authentication when using the edX Enrollment API:
|
||||
|
||||
* `OAuth 2.0`_
|
||||
* `Session Authentication`_
|
||||
|
||||
.. note::
|
||||
You do not need to authenticate to :ref:`get enrollment details for a course
|
||||
<Get Enrollment Details for a Course>`.
|
||||
|
||||
*************
|
||||
OAuth 2.0
|
||||
*************
|
||||
|
||||
The edX Enrollment API uses OAuth 2.0 for authentication. OAuth 2.0 is an open
|
||||
standard used by many systems that require secure user authentication. See the
|
||||
`OAuth 2.0 Standard`_ standard for more information.
|
||||
|
||||
========================================
|
||||
Registering with Your Open edX Instance
|
||||
========================================
|
||||
|
||||
To use the edX Enrollment API with courses on you instance of Open edX, you
|
||||
must register your application with the Open edX server. See the OAuth 2.0
|
||||
specification for details.
|
||||
|
||||
**************************
|
||||
Session Authentication
|
||||
**************************
|
||||
|
||||
To use the edX Enrollment API, you can use session authentication in your
|
||||
application.
|
||||
|
||||
You must authenticate as a registred edX user.
|
||||
|
||||
.. include:: links.rst
|
||||
76
docs/en_us/enrollment_api/source/conf.py
Normal file
76
docs/en_us/enrollment_api/source/conf.py
Normal file
@@ -0,0 +1,76 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# pylint: disable=invalid-name
|
||||
# pylint: disable=redefined-builtin
|
||||
# pylint: disable=protected-access
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
import os
|
||||
from path import path
|
||||
import sys
|
||||
|
||||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
||||
|
||||
sys.path.append('../../../../')
|
||||
|
||||
from docs.shared.conf import *
|
||||
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
#templates_path.append('source/_templates')
|
||||
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
#html_static_path.append('source/_static')
|
||||
|
||||
if not on_rtd: # only import and set the theme if we're building docs locally
|
||||
import sphinx_rtd_theme
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
root = path('../../../../').abspath()
|
||||
sys.path.insert(0, root)
|
||||
sys.path.append(root / "common/djangoapps")
|
||||
sys.path.append('.')
|
||||
|
||||
#sys.path.insert(
|
||||
# 0,
|
||||
# os.path.abspath(
|
||||
# os.path.normpath(
|
||||
# os.path.dirname(__file__) + '/../../../..'
|
||||
# )
|
||||
# )
|
||||
#)
|
||||
|
||||
|
||||
# django configuration - careful here
|
||||
if on_rtd:
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'lms'
|
||||
else:
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'lms'
|
||||
|
||||
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath',
|
||||
'sphinx.ext.mathjax', 'sphinx.ext.viewcode', 'sphinxcontrib.napoleon']
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = ['build', 'links.rst']
|
||||
|
||||
|
||||
project = u'edX Enrollment API Version 1'
|
||||
copyright = u'2015, edX'
|
||||
|
||||
|
||||
25
docs/en_us/enrollment_api/source/endpoints.rst
Normal file
25
docs/en_us/enrollment_api/source/endpoints.rst
Normal file
@@ -0,0 +1,25 @@
|
||||
.. _edX Enrollment API Endpoints:
|
||||
|
||||
################################################
|
||||
edX Enrollment API Endpoints
|
||||
################################################
|
||||
|
||||
The edX Platform API allows you to view information about users and their course enrollments, course information, and videos and transcripts.
|
||||
|
||||
The following tasks and endpoints are currently supported.
|
||||
|
||||
|
||||
.. list-table::
|
||||
:widths: 10 70
|
||||
:header-rows: 1
|
||||
|
||||
* - To:
|
||||
- Use this endpoint:
|
||||
* - :ref:`Get the user's enrollment status in a course <Get the Users Enrollment Status in a Course>`
|
||||
- /api/enrollment/v1/enrollment/{user_id},{course_id}
|
||||
* - :ref:`Get enrollment details for a course<Get Enrollment Details for a Course>`
|
||||
- /api/enrollment/v1/course/{course_id}
|
||||
* - :ref:`View a user's enrollments <View and add to a Users Course Enrollments>`
|
||||
- /api/enrollment/v1/enrollment
|
||||
* - :ref:`Enroll a user in a course <View and add to a Users Course Enrollments>`
|
||||
- /api/enrollment/v1/enrollment{“course_details”:{“course_id”:“*course_id*”}}
|
||||
168
docs/en_us/enrollment_api/source/enrollment.rst
Normal file
168
docs/en_us/enrollment_api/source/enrollment.rst
Normal file
@@ -0,0 +1,168 @@
|
||||
##################################################
|
||||
Enrollment API Module
|
||||
##################################################
|
||||
|
||||
.. module:: enrollment
|
||||
|
||||
This page contains information on using the Enrollment API to:
|
||||
|
||||
* :ref:`Get the user's enrollment status in a course <Get the Users Enrollment Status in a Course>`
|
||||
* :ref:`Get enrollment details for a course<Get Enrollment Details for a Course>`
|
||||
* :ref:`View a user's enrollments <View and add to a Users Course Enrollments>`
|
||||
* :ref:`Enroll a user in a course <View and add to a Users Course Enrollments>`
|
||||
|
||||
|
||||
.. _Get the Users Enrollment Status in a Course:
|
||||
|
||||
********************************************
|
||||
Get the User's Enrollment Status in a Course
|
||||
********************************************
|
||||
|
||||
.. autoclass:: enrollment.views.EnrollmentView
|
||||
|
||||
**Example response showing the user's enrollment status in a course**
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
HTTP 200 OK
|
||||
Content-Type: application/json
|
||||
Vary: Accept
|
||||
Allow: GET, HEAD, OPTIONS
|
||||
|
||||
{
|
||||
"created": "2014-11-19T04:06:55Z",
|
||||
"mode": "honor",
|
||||
"is_active": true,
|
||||
"course_details": {
|
||||
"course_id": "edX/DemoX/Demo_Course",
|
||||
"enrollment_end": null,
|
||||
"course_modes": [
|
||||
{
|
||||
"slug": "honor",
|
||||
"name": "Honor Code Certificate",
|
||||
"min_price": 0,
|
||||
"suggested_prices": [],
|
||||
"currency": "usd",
|
||||
"expiration_datetime": null,
|
||||
"description": null
|
||||
}
|
||||
],
|
||||
"enrollment_start": null,
|
||||
"invite_only": false
|
||||
},
|
||||
"user": "staff"
|
||||
}
|
||||
|
||||
.. _Get Enrollment Details for a Course:
|
||||
|
||||
************************************
|
||||
Get Enrollment Details for a Course
|
||||
************************************
|
||||
|
||||
.. autoclass:: enrollment.views.EnrollmentCourseDetailView
|
||||
|
||||
**Example response showing a user's course enrollments**
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
HTTP 200 OK
|
||||
Content-Type: application/json
|
||||
Vary: Accept
|
||||
Allow: GET, HEAD, OPTIONS
|
||||
|
||||
{
|
||||
"course_id": "edX/DemoX/Demo_Course",
|
||||
"enrollment_end": null,
|
||||
"course_modes": [
|
||||
{
|
||||
"slug": "honor",
|
||||
"name": "Honor Code Certificate",
|
||||
"min_price": 0,
|
||||
"suggested_prices": [],
|
||||
"currency": "usd",
|
||||
"expiration_datetime": null,
|
||||
"description": null
|
||||
}
|
||||
],
|
||||
"enrollment_start": null,
|
||||
"invite_only": false
|
||||
}
|
||||
|
||||
|
||||
.. _View and add to a Users Course Enrollments:
|
||||
|
||||
*********************************************
|
||||
View and Add to a User's Course Enrollments
|
||||
*********************************************
|
||||
|
||||
.. autoclass:: enrollment.views.EnrollmentListView
|
||||
|
||||
|
||||
**Example response showing a user's course enrollments**
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
HTTP 200 OK
|
||||
Content-Type: application/json
|
||||
Vary: Accept
|
||||
Allow: GET, POST, HEAD, OPTIONS
|
||||
|
||||
[
|
||||
{
|
||||
"created": "2014-09-19T18:08:37Z",
|
||||
"mode": "honor",
|
||||
"is_active": true,
|
||||
"course_details": {
|
||||
"course_id": "edX/DemoX/Demo_Course",
|
||||
"enrollment_end": null,
|
||||
"course_modes": [
|
||||
{
|
||||
"slug": "honor",
|
||||
"name": "Honor Code Certificate",
|
||||
"min_price": 0,
|
||||
"suggested_prices": [],
|
||||
"currency": "usd",
|
||||
"expiration_datetime": null,
|
||||
"description": null
|
||||
}
|
||||
],
|
||||
"enrollment_start": null,
|
||||
"invite_only": false
|
||||
},
|
||||
"user": "honor"
|
||||
},
|
||||
{
|
||||
"created": "2014-09-19T18:09:35Z",
|
||||
"mode": "honor",
|
||||
"is_active": true,
|
||||
"course_details": {
|
||||
"course_id": "ArbisoftX/BulkyEmail101/2014-15",
|
||||
"enrollment_end": null,
|
||||
"course_modes": [
|
||||
{
|
||||
"slug": "honor",
|
||||
"name": "Honor Code Certificate",
|
||||
"min_price": 0,
|
||||
"suggested_prices": [],
|
||||
"currency": "usd",
|
||||
"expiration_datetime": null,
|
||||
"description": null
|
||||
}
|
||||
],
|
||||
"enrollment_start": "2014-05-01T04:00:00Z",
|
||||
"invite_only": false
|
||||
},
|
||||
"user": "honor"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
**Example post request to enroll the user in a new course**
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
“course_details”: {
|
||||
“course_id”: “edX/DemoX/Demo_Course”
|
||||
}
|
||||
}
|
||||
13
docs/en_us/enrollment_api/source/index.rst
Normal file
13
docs/en_us/enrollment_api/source/index.rst
Normal file
@@ -0,0 +1,13 @@
|
||||
################################################
|
||||
edX Enrollment API Version 1
|
||||
################################################
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
read_me
|
||||
preface
|
||||
overview
|
||||
authentication
|
||||
endpoints
|
||||
enrollment
|
||||
1
docs/en_us/enrollment_api/source/links.rst
Normal file
1
docs/en_us/enrollment_api/source/links.rst
Normal file
@@ -0,0 +1 @@
|
||||
.. _OAuth 2.0 Standard: https://tools.ietf.org/html/draft-ietf-oauth-v2-31
|
||||
37
docs/en_us/enrollment_api/source/overview.rst
Normal file
37
docs/en_us/enrollment_api/source/overview.rst
Normal file
@@ -0,0 +1,37 @@
|
||||
.. _edX Enrollment API Overview:
|
||||
|
||||
################################################
|
||||
edX Enrollment API Overview
|
||||
################################################
|
||||
|
||||
The edX Enrollment API enables you to view user and course enrollment
|
||||
information, and to enroll a user in a course.
|
||||
|
||||
The edX Platform API uses Representational State Transfer (REST) design
|
||||
principles and supports the JavaScript Object Notation (JSON) data-interchange
|
||||
format. Our REST API is simple, lightweight and optimized.
|
||||
|
||||
You can use the edX Enrollment API for web, desktop, and mobile applications.
|
||||
|
||||
*************************************
|
||||
edX Enrollment API Version 1
|
||||
*************************************
|
||||
|
||||
The edX Enrollment API is currently at version 1.0. We plan on making
|
||||
significant enhancements to this API.
|
||||
|
||||
********************************
|
||||
edX Enrollment API Capabilities
|
||||
********************************
|
||||
|
||||
With the edX Enrollment API, you can:
|
||||
|
||||
* :ref:`Get the user's enrollment status in a Course <Get the Users Enrollment
|
||||
Status in a Course>`
|
||||
|
||||
* :ref:`Get enrollment details for a course<Get Enrollment Details for a
|
||||
Course>`
|
||||
|
||||
* :ref:`View a user's enrollments <View and add to a Users Course Enrollments>`
|
||||
|
||||
* :ref:`Enroll a user in a course <View and add to a Users Course Enrollments>`
|
||||
1
docs/en_us/enrollment_api/source/preface.rst
Normal file
1
docs/en_us/enrollment_api/source/preface.rst
Normal file
@@ -0,0 +1 @@
|
||||
.. include:: ../../shared/preface.rst
|
||||
17
docs/en_us/enrollment_api/source/read_me.rst
Normal file
17
docs/en_us/enrollment_api/source/read_me.rst
Normal file
@@ -0,0 +1,17 @@
|
||||
########
|
||||
Read Me
|
||||
########
|
||||
|
||||
The edX Enrollment API documentation is created using RST_
|
||||
files and Sphinx_. You, the user community, can help update and revise this
|
||||
documentation project on GitHub:
|
||||
|
||||
https://github.com/edx/edx-platform/tree/master/docs/enrollment_api/source
|
||||
|
||||
To suggest a revision, fork the project, make changes in your fork, and submit
|
||||
a pull request back to the original project: this is known as the `GitHub Flow`_.
|
||||
|
||||
.. _Sphinx: http://sphinx-doc.org/
|
||||
.. _LaTeX: http://www.latex-project.org/
|
||||
.. _`GitHub Flow`: https://github.com/blog/1557-github-flow-in-the-browser
|
||||
.. _RST: http://docutils.sourceforge.net/rst.html
|
||||
@@ -147,7 +147,7 @@ html_theme = 'default'
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = add_base(['_static'])
|
||||
#html_static_path = add_base(['_static'])
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
|
||||
Reference in New Issue
Block a user