Commit 79300c00 by Robert Raposa Committed by GitHub

Merge pull request #15107 from edx/rraposa/docs-cleanup

LEARNER-909: Clean-up the edx-platform repo documentation
parents 9380b6b5 6bd64c4a
...@@ -51,21 +51,9 @@ in. If you do not have an account, follow these steps. ...@@ -51,21 +51,9 @@ in. If you do not have an account, follow these steps.
Documentation Documentation
------------- -------------
Documentation is managed in the `edx-documentation`_ repository. Documentation Documentation details can be found in the `docs index.rst`_.
is built using `Sphinx`_: you can `view the built documentation on
ReadTheDocs`_.
You can also check out `Confluence`_, our wiki system. Once you sign up for
an account, you'll be able to create new pages and edit existing pages, just
like in any other wiki system. You only need one account for both Confluence
and `JIRA`_, our issue tracker.
.. _Sphinx: http://sphinx-doc.org/
.. _view the built documentation on ReadTheDocs: http://docs.edx.org/
.. _edx-documentation: https://github.com/edx/edx-documentation
.. _Confluence: http://openedx.atlassian.net/wiki/
.. _JIRA: https://openedx.atlassian.net/
.. _docs index.rst: docs/index.rst
Getting Help Getting Help
------------ ------------
......
...@@ -1268,7 +1268,7 @@ AFFILIATE_COOKIE_NAME = 'affiliate_id' ...@@ -1268,7 +1268,7 @@ AFFILIATE_COOKIE_NAME = 'affiliate_id'
############## Settings for Studio Context Sensitive Help ############## ############## Settings for Studio Context Sensitive Help ##############
HELP_TOKENS_INI_FILE = REPO_ROOT / "docs" / "cms_config.ini" HELP_TOKENS_INI_FILE = REPO_ROOT / "cms" / "envs" / "help_tokens.ini"
# Theme directory locale paths # Theme directory locale paths
COMPREHENSIVE_THEME_LOCALE_PATHS = [] COMPREHENSIVE_THEME_LOCALE_PATHS = []
......
################### See `index.rst <index.rst>`_ for details.
EdX Documentation
###################
The following documentation projects have been moved to the `edx-documentation`_ repository as of November 3, 2014:
* course_authors
* data
* developers
* install_operations
* mobile
* OLX
* ORA-2
* release_notes
* students
API documentation that includes docstrings from code files is stored in the
repository of that module. All other documentation projects are stored in edx-
documentation.
By moving documentation to its own repository, we will be better able to
develop workflows, manage versioning, create translations, and automate
testing, without complicating ongoing development of the edX Platform.
.. _edx_documentation: https://github.com/edx/edx-documentation
******************************
View Published Documentation
******************************
EdX documentation is published through Read the Docs. Links to all published
documentation are available through `docs.edx.org`_.
.. _docs.edx.org: http://docs.edx.org
******************************
Submit Documentation Issues
******************************
We welcome input from the community on any documentation issues. You can
submit issues to the Documentation project in the `Open edX JIRA board`_.
You will need to `create a free JIRA account`_ account before you can submit your first
ticket.
.. _create a free JIRA account: https://openedx.atlassian.net/admin/users/sign-up
.. _Open edX JIRA board: https://openedx.atlassian.net
You can also email docs@edx.org.
.PHONY: html
Q_FLAG =
ifeq ($(quiet), true)
Q_FLAG = quiet=true
endif
html:
@cd $(CURDIR)/data && make html $(Q_FLAG)
@cd $(CURDIR)/course_authors && make html $(Q_FLAG)
@cd $(CURDIR)/developers && make html $(Q_FLAG)
@cd $(CURDIR)/install_operations && make html $(Q_FLAG)
@cd $(CURDIR)/ORA2 && make html $(Q_FLAG)
@cd $(CURDIR)/release_notes && make html $(Q_FLAG)
######################
EdX Developer's Guide
######################
We have moved the edX Developer's Guide to the `edx-documentation`_ repository
as of January 13, 2015.
By moving documentation to its own repository, we will be better able to
develop workflows, manage versioning, create translations, and automate
testing, without complicating ongoing development of the edX Platform.
.. _edx-documentation: https://github.com/edx/edx-documentation
******************************
EdX Platform Docstrings
******************************
We are in the process of creating a new project to publish docstrings for the
edX Platform. Docstrings will be included for CMS, LMS, and Common modules.
This project will remain in the edX Platform repository, in the docs/en-us
directory.
******************************
View Published Documentation
******************************
EdX documentation is published through Read the Docs. Links to all published
documentation are available through `docs.edx.org`_.
.. _docs.edx.org: http://docs.edx.org
******************************
Submit Documentation Issues
******************************
We welcome input from the community on any documentation issues. You can
submit issues to the Documentation project in the `Open edX JIRA board`_.
You will need to `create a free JIRA account`_ account before you can submit your first
ticket.
.. _create a free JIRA account: https://openedx.atlassian.net/admin/users/sign-up
.. _Open edX JIRA board: https://openedx.atlassian.net
You can also email docs@edx.org.
# 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."
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
{% extends "!layout.html" %}
{% block header %}
<img src="{{ pathto("_static/homepage-bg.jpg", 1) }}" alt="Edx logo" width="100%;"/>
{% endblock %}
\ No newline at end of file
# -*- 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 as path
import sys
import mock
MOCK_MODULES = [
'ipware',
'ip',
'ipware.ip',
'get_ip',
'pygeoip',
'ipaddr',
'django_countries',
'fields',
'django_countries.fields',
'opaque_keys',
'opaque_keys.edx',
'opaque_keys.edx.keys',
'CourseKey',
'UsageKey',
'BlockTypeKey',
'opaque_keys.edx.locations',
'SlashSeparatedCourseKey',
'Location',
'opaque_keys.edx.locator',
'Locator',
]
for mod_name in MOCK_MODULES:
sys.modules[mod_name] = mock.Mock()
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 = 'edX Enrollment API Version 1'
################################################
edX Enrollment API Version 1
################################################
This documentation has moved. Enrollment API information is now included in the `EdX Platform APIs documentation <http://edx.readthedocs.org/projects/edx-platform-api/en/latest/>`_.
# Development Tasks
## Prerequisites
### Ruby
To install all of the required ruby libraries, run `bundle install`.
This will read the `Gemfile` and install all of the gems specified there.
### Python
Run the following::
pip install -r requirements.txt
### Binaries
Install the following:
* Mongodb (http://www.mongodb.org/)
### Databases
First start up the MongoDB daemon. E.g. to start it up in the background
using a config file (sometimes using `sudo` is required):
mongod --config /usr/local/etc/mongod.conf &
On some Linux distributions the configuration script is located at:
/etc/mongodb.conf
If MongoDB does not start properly, it might be the case that there is a stray
lock file somewhere, or that the configuration file is corrupt. In this case
try deleting the lock files, and then running the MongoDB repair script:
sudo rm -rf /data/db/mongod.lock
sudo rm -rf /var/lib/mongodb/mongod.lock
sudo -u mongodb mongod -f /usr/local/etc/mongod.conf --repair
To verify that MongoDB started up OK, run the MongoDB client:
mongo
After MongoDB daemon is successfully running, check out the course data
directories that you want to work with into the `GITHUB_REPO_ROOT` (by default,
`../data`). Then run the following command:
paver update_db
## Installing
To create your development environment, run the shell script in the root of
the repo:
scripts/create-dev-env.sh
## Starting development servers
Both the LMS and Studio can be started using the following shortcut tasks
paver lms # Start the LMS
paver studio # Start studio
paver lms --settings=cms.dev # Start LMS to run alongside Studio
paver lms --settings=cms.dev_preview # Start LMS to run alongside Studio in preview mode
Under the hood, this executes `./manage.py {lms|cms} --settings $ENV runserver`,
which starts a local development server.
Both of these commands take arguments to start the servers in different environments
or with additional options:
# Start the LMS using the test configuration, on port 5000
paver lms --settings=test --port=5000 # Executes ./manage.py lms --settings test runserver 5000
To get a full list of available paver tasks, run:
paver --help
### Troubleshooting
#### Reference Error: XModule is not defined (javascript)
This means that the javascript defining an xmodule hasn't loaded correctly. There are a number
of different things that could be causing this:
1. See `Error: watch EMFILE`
#### Error: watch EMFILE (coffee)
When running a development server, we also start a watcher process alongside to recompile coffeescript
and sass as changes are made. On Mac OSX systems, the coffee watcher process takes more file handles
than are allowed by default. This will result in `EMFILE` errors when coffeescript is running, and
will prevent javascript from compiling, leading to the error 'XModule is not defined'
To work around this issue, we use `Process::setrlimit` to set the number of allowed open files.
Coffee watches both directories and files, so you will need to set this fairly high (anecdotally,
8000 seems to do the trick on OSX 10.7.5, 10.8.3, and 10.8.4)
## Running Tests
See `testing.rst` for instructions on running the test suite.
## Content development
If you change course content, while running the LMS in dev mode, it is unnecessary to restart to refresh the modulestore.
Instead, hit /migrate/modules to see a list of all modules loaded, and click on links (eg /migrate/reload/edx4edx) to reload a course.
### Gitreload-based workflow
github (or other equivalent git-based repository systems) used for
course content can be setup to trigger an automatic reload when changes are pushed. Here is how:
1. Each content directory in edx_all/data should be a clone of a git repo
2. The user running the edx gunicorn process should have its ssh key registered with the git repo
3. The list settings.ALLOWED_GITRELOAD_IPS should contain the IP address of the git repo originating the gitreload request.
By default, this list is ['207.97.227.253', '50.57.128.197', '108.171.174.178'] (the github IPs).
The list can be overridden in the startup file used, eg lms/envs/dev*.py
4. The git post-receive-hook should POST to /gitreload with a JSON payload. This payload should define at least
{ "repository" : { "name" : reload_dir }
where reload_dir is the directory name of the content to reload (ie edx_all/data/reload_dir should exist)
The edx server will then do "git reset --hard HEAD; git clean -f -d; git pull origin" in that directory. After the pull,
it will reload the modulestore for that course.
Note that the gitreload-based workflow is not meant for deployments on AWS (or elsewhere) which use collectstatic, since collectstatic is not run by a gitreload event.
Also, the gitreload feature needs FEATURES['ENABLE_LMS_MIGRATION'] = True in the django settings.
# Running the discussion service
## Instruction for Mac
## Installing Mongodb
If you haven't done so already:
brew install mongodb
Make sure that you have mongodb running. You can simply open a new terminal tab and type:
mongod
## Installing elasticsearch
brew install elasticsearch
For debugging, it's often more convenient to have elasticsearch running in a terminal tab instead of in background. To do so, simply open a new terminal tab and then type:
elasticsearch -f
## Setting up the discussion service
You can retrieve the source code from the [github repository](https://github.com/edx/cs_comments_service).
First go into the edx_all directory. Then type
git clone https://github.com/edx/cs_comments_service.git
cd cs_comments_service/
If you see a prompt asking "Do you wish to trust this .rvmrc file?", type "y"
Now if you see this error "Gemset 'cs_comments_service' does not exist," run the following command to create the gemset and then use the rvm environment manually:
rvm gemset create 'cs_comments_service'
rvm use 1.9.3@cs_comments_service
Now use the following command to install required packages:
bundle install
The following command creates database indexes:
bundle exec rake db:init
Now use the following command to generate seeds (basically some random comments in Latin):
bundle exec rake db:seed
It's done! Launch the app now:
ruby app.rb
## Integrating with the edx platform
The API key must match on both sides. It is configured here:
* edx-platform: COMMENTS_SERVICE_KEY in your dev.py file (dev environment) or ENV_TOKENS (prod environment)
* cs_comments_service: api_key in the application.yml file (dev environment) or ENV variable (prod environment)
## Running the delayed job worker
In the discussion service, notifications are handled asynchronously using a third party gem called delayed_job. If you want to test this functionality, run the following command in a separate tab:
bundle exec rake jobs:work
## From the edx-platform django app, initialize roles and permissions
To fully test the discussion forum, you might want to act as a moderator or an administrator. Currently, the roles are:
* moderators can manage everything in the forum, and
* administrators can manage everything plus assigning and revoking moderator status of other users.
First make sure that the database is up-to-date:
paver update_db
If you have created users in the edx-platform django apps when the comment service was not running, you will need to one-way sync the users into the comment service back end database:
./manage.py lms sync_user_info
Now initialize roles and permissions, providing a course id. See the example below. Note that you do not need to do this for Studio-created courses, as the Studio application does this for you.
./manage.py lms seed_permissions_roles "MITx/6.002x/2012_Fall"
To assign yourself as a moderator, use the following command (assuming your username is "test", and the course id is "MITx/6.002x/2012_Fall"):
./manage.py lms assign_role test Moderator "MITx/6.002x/2012_Fall"
To assign yourself as an administrator, use the following command
./manage.py lms assign_role test Administrator "MITx/6.002x/2012_Fall"
## Some other useful commands
### generate seeds for a specific forum
The seed generating command above assumes that you have the following discussion tags somewhere in the course data:
<discussion for="Welcome Video" id="video_1" discussion_category="Video"/>
<discussion for="Lab 0: Using the Tools" id="lab_1" discussion_category="Lab"/>
<discussion for="Lab Circuit Sandbox" id="lab_2" discussion_category="Lab"/>
For example, you can insert them into overview section as following:
<chapter name="Overview">
<section format="Video" name="Welcome">
<vertical>
<video youtube="0.75:izygArpw-Qo,1.0:p2Q6BrNhdh8,1.25:1EeWXzPdhSA,1.50:rABDYkeK0x8"/>
<discussion for="Welcome Video" id="video_1" discussion_category="Video"/>
</vertical>
</section>
<section format="Lecture Sequence" name="System Usage Sequence">
<%include file="sections/introseq.xml"/>
</section>
<section format="Lab" name="Lab0: Using the tools">
<vertical>
<html> See the <a href="/section/labintro"> Lab Introduction </a> or <a href="/static/handouts/schematic_tutorial.pdf">Interactive Lab Usage Handout </a> for information on how to do the lab </html>
<problem name="Lab 0: Using the Tools" filename="Lab0" rerandomize="false"/>
<discussion for="Lab 0: Using the Tools" id="lab_1" discussion_category="Lab"/>
</vertical>
</section>
<section format="Lab" name="Circuit Sandbox">
<vertical>
<problem name="Circuit Sandbox" filename="Lab_sandbox" rerandomize="false"/>
<discussion for="Lab Circuit Sandbox" id="lab_2" discussion_category="Lab"/>
</vertical>
</section>
</chapter>
Currently, only the attribute "id" is actually used, which identifies discussion forum. In the code for the data generator, the corresponding lines are:
generate_comments_for("video_1")
generate_comments_for("lab_1")
generate_comments_for("lab_2")
We also have a command for generating comments within a forum with the specified id:
bundle exec rake db:generate_comments[type_the_discussion_id_here]
For instance, if you want to generate comments for a new discussion tab named "lab_3", then use the following command
bundle exec rake db:generate_comments[lab_3]
### Running tests for the service
bundle exec rspec
Warning: the development and test environments share the same elasticsearch index. After running tests, search may not work in the development environment. You simply need to reindex:
bundle exec rake db:reindex_search
### debugging the service
You can use the following command to launch a console within the service environment:
bundle exec rake console
### show user roles and permissions
Use the following command to see the roles and permissions of a user in a given course (assuming, again, that the username is "test"):
./manage.py lms show_permissions moderator
You need to make sure that the environment variables are exported. Otherwise you would need to do
./manage.py lms show_permissions moderator
See: https://openedx.atlassian.net/wiki/display/TE/Jenkins+Guide
See: https://openedx.atlassian.net/wiki/display/TE/Jenkins+Guide
See: https://openedx.atlassian.net/wiki/display/TE/Jenkins+Guide
See: https://openedx.atlassian.net/wiki/display/TE/Jenkins+Guide
# Notes on using mongodb backed LMS and CMS
These are some random notes for developers, on how things are stored in mongodb, and how to debug mongodb data.
## Databases
Two mongodb databases are used:
- xmodule: stores module definitions and metadata (modulestore)
- xcontent: stores filesystem content, like PDF files
modulestore documents are stored with an _id which has fields like this:
{"_id": {"tag":"i4x","org":"HarvardX","course":"CS50x","category":"chapter","name":"Week_1","revision":null}}
## Document fields
### Problems
Here is an example showing the fields available in problem documents:
{
"_id" : {
"tag" : "i4x",
"org" : "MITx",
"course" : "6.00x",
"category" : "problem",
"name" : "ps03:ps03-Hangman_part_2_The_Game",
"revision" : null
},
"definition" : {
"data" : " ..."
},
"metadata" : {
"display_name" : "Hangman Part 2: The Game",
"attempts" : "30",
"title" : "Hangman, Part 2",
"data_dir" : "6.00x",
"type" : "lecture"
}
}
## Sample interaction with mongodb
1. "mongo"
2. "use xmodule"
3. "show collections" should give "modulestore" and "system.indexes"
4. 'db.modulestore.find( {"_id.org": "MITx"} )' will produce a list of all MITx course documents
5. 'db.modulestore.find( {"_id.org": "MITx", "_id.category": "problem"} )' will produce a list of all problems in MITx courses
Example query for finding all files with "image" in the filename:
- use xcontent
- db.fs.files.find({'filename': /image/ } )
- db.fs.files.find({'filename': /image/ } ).count()
## Debugging the mongodb contents
A convenient tool is http://phpmoadmin.com/ (needs php)
Under ubuntu, do:
- apt-get install php5-fpm php-pear
- pecl install mongo
- edit /etc/php5/fpm/php.ini to add "extension=mongo.so"
- /etc/init.d/php5-fpm restart
and also setup nginx to run php through fastcgi.
## Backing up mongodb
- mogodump (dumps all dbs)
- mongodump --collection modulestore --db xmodule (dumps just xmodule/modulestore)
- mongodump -d xmodule -q '{"_id.org": "MITx"}' (dumps just MITx documents in xmodule)
- mongodump -q '{"_id.org": "MITx"}' (dumps all MITx documents)
## Deleting course content
Use "remove" instead of "find":
- db.modulestore.remove( {"_id.course": "8.01greytak"})
## Finding useful information from the mongodb modulestore
- Organizations
> db.modulestore.distinct( "_id.org")
[ "HarvardX", "MITx", "edX", "edx" ]
- Courses
> db.modulestore.distinct( "_id.course")
[
"CS50x",
"PH207x",
"3.091x",
"6.002x",
"6.00x",
"8.01esg",
"8.01rq_MW",
"8.02teal",
"8.02x",
"edx4edx",
"toy",
"templates"
]
- Find a problem which has the word "quantum" in its definition
db.modulestore.findOne( {"definition.data":/quantum/})n
- Find Location for all problems with the word "quantum" in its definition
db.modulestore.find( {"definition.data":/quantum/}, {'_id':1})
- Number of problems in each course
db.runCommand({
mapreduce: "modulestore",
query: { '_id.category': 'problem' },
map: function(){ emit(this._id.course, {count:1}); },
reduce: function(key, values){
var result = {count:0};
values.forEach(function(value) {
result.count += value.count;
});
return result;
},
out: 'pbyc',
verbose: true
});
produces:
> db.pbyc.find()
{ "_id" : "3.091x", "value" : { "count" : 184 } }
{ "_id" : "6.002x", "value" : { "count" : 176 } }
{ "_id" : "6.00x", "value" : { "count" : 147 } }
{ "_id" : "8.01esg", "value" : { "count" : 184 } }
{ "_id" : "8.01rq_MW", "value" : { "count" : 73 } }
{ "_id" : "8.02teal", "value" : { "count" : 5 } }
{ "_id" : "8.02x", "value" : { "count" : 99 } }
{ "_id" : "PH207x", "value" : { "count" : 25 } }
{ "_id" : "edx4edx", "value" : { "count" : 50 } }
{ "_id" : "templates", "value" : { "count" : 11 } }
These are the indexes each mongo db should have in order to perform well.
Each section states the collection name and then the indexes. To create an index,
you'll typically either use the mongohq type web interface or a standard terminal console.
If a terminal, this assumes you've logged in and gotten to the mongo prompt
```
mongo mydatabasename
```
If using the terminal, to add an index to a collection, you'll need to prefix ```ensureIndex``` with
```
db.collection_name
```
as in ```db.location_map.ensureIndex({'course_id': 1}{background: true})```
fs.files:
=========
Index needed thru 'category' by `_get_all_content_for_course` and others. That query also takes a sort
which can be `uploadDate`, `display_name`,
Replace existing index which leaves out `run` with this one:
```
ensureIndex({'_id.org': 1, '_id.course': 1, '_id.name': 1}, {'sparse': true})
ensureIndex({'content_son.org': 1, 'content_son.course': 1, 'content_son.name': 1}, {'sparse': true})
ensureIndex({'_id.org': 1, '_id.course': 1, 'uploadDate': 1}, {'sparse': true})
ensureIndex({'_id.org': 1, '_id.course': 1, 'display_name': 1}, {'sparse': true})
ensureIndex({'content_son.org': 1, 'content_son.course': 1, 'uploadDate': 1}, {'sparse': true})
ensureIndex({'content_son.org': 1, 'content_son.course': 1, 'display_name': 1}, {'sparse': true})
```
modulestore:
============
Mongo automatically indexes the ```_id``` field but as a whole. Thus, for queries against modulestore such
as ```modulestore.find({'_id': {'tag': 'i4x', 'org': 'myu', 'course': 'mycourse', 'category': 'problem', 'name': '221abc', 'revision': null}})```
where every field in the id is given in the same order as the field is stored in the record in the db
and no field is omitted.
Because we often query for some subset of the id, we define this index:
```
ensureIndex({'_id.org': 1, '_id.course': 1, '_id.category': 1, '_id.name': 1})
```
Because we often scan for all category='course' regardless of the value of the other fields:
```
ensureIndex({'_id.category': 1})
```
Because lms calls get_parent_locations frequently (for path generation):
```
ensureIndex({'definition.children': 1}, {'sparse': true})
```
modulestore.active_versions
===========================
```
ensureIndex({'org': 1, 'course': 1, 'run': 1}, {'unique': true})
```
# Documentation for edX code (edx-platform repo)
This document explains the general structure of the edX platform, and defines some of the acronyms and terms you'll see flying around in the code.
## Assumptions:
You should be familiar with the following. If you're not, go read some docs...
- [python](http://docs.python.org)
- [django](http://docs.djangoproject.com)
- javascript
- html, xml -- xpath, xslt
- css
- [git](http://git-scm.com/documentation)
- [mako templates](http://www.makotemplates.org/docs) -- we use these instead of django templates, because they support embedding real python.
## Other relevant terms
- CAPA -- lon-capa.org -- content management system that has defined a standard for online learning and assessment materials. Many of our materials follow this standard.
- TODO: add more details / link to relevant docs. lon-capa.org is not immediately intuitive.
- lcp = loncapa problem
## Parts of the system
- LMS -- Learning Management System. The student-facing parts of the system. Handles student accounts, displaying videos, tutorials, exercies, problems, etc.
- CMS -- Course Management System. The instructor-facing parts of the system. Allows instructors to see and modify their course, add lectures, problems, reorder things, etc.
- Forums -- this is a ruby on rails service that runs on Heroku. Contributed by berkeley folks. The LMS has a wrapper lib that talks to it.
- Data. In the data/ dir. There is currently a single `course.xml` file that describes an entire course. Speaking of which...
- Courses. A course is broken up into Chapters ("week 1", "week 2", etc). A chapter is broken up into Sections ("Lecture 1", "Simple Circuits Exercises", "HW1", etc). A section can contain modules: Problems, Html, Videos, Verticals, or Sequences.
- Problems: specified in problem files. May have python scripts embedded to both generate random parameters and check answers. Also allows specifying things like tolerance or precision in answers
- Html: any html - often description, or links to outside resources
- Videos: links to youtube or elsewhere
- Verticals: a nesting tag: collect several videos, problems, html modules and display them vertically.
- Sequences: a sequence of modules, displayed with a horizontal navigation bar, displaying one component at a time.
- see `data/course.xml` for more examples
## High Level Entities in the code
### Common libraries
- xmodule: generic learning modules. *x* can be sequence, video, template, html,
vertical, capa, etc. These are the things that one puts inside sections
in the course structure.
- XModuleDescriptor: This defines the problem and all data and UI needed to edit
that problem. It is unaware of any student data, but can be used to retrieve
an XModule, which is aware of that student state.
- XModule: The XModule is a problem instance that is particular to a student. It knows
how to render itself to html to display the problem, how to score itself,
and how to handle ajax calls from the front end.
- Both XModule and XModuleDescriptor take system context parameters. These are named
ModuleSystem and DescriptorSystem respectively. These help isolate the XModules
from any interactions with external resources that they require.
For instance, the DescriptorSystem has a function to load an XModuleDescriptor
from a Location object, and the ModuleSystem knows how to render things,
track events, and complain about 404s
- XModules and XModuleDescriptors are uniquely identified by a Location object, encoding the organization, course, category, name, and possibly revision of the module.
- XModule initialization: XModules are instantiated by the `XModuleDescriptor.xmodule` method, and given a ModuleSystem, the descriptor which instantiated it, and their relevant model data.
- XModuleDescriptor initialization: If an XModuleDescriptor is loaded from an XML-based course, the XML data is passed into its `from_xml` method, which is responsible for instantiating a descriptor with the correct attributes. If it's in Mongo, the descriptor is instantiated directly. The module's attributes will be present in the `model_data` dict.
- `course.xml` format. We use python setuptools to connect supported tags with the descriptors that handle them. See `common/lib/xmodule/setup.py`. There are checking and validation tools in `common/validate`.
- the xml import+export functionality is in `xml_module.py:XmlDescriptor`, which is a mixin class that's used by the actual descriptor classes.
- There is a distinction between descriptor _definitions_ that stay the same for any use of that descriptor (e.g. here is what a particular problem is), and _metadata_ describing how that descriptor is used (e.g. whether to allow checking of answers, due date, etc). When reading in `from_xml`, the code pulls out the metadata attributes into a separate structure, and puts it back on export.
- in `common/lib/xmodule`
- capa modules -- defines `LoncapaProblem` and many related things.
- in `common/lib/capa`
### LMS
The LMS is a django site, with root in `lms/`. It runs in many different environments--the settings files are in `lms/envs`.
- We use the Django Auth system, including the is_staff and is_superuser flags. User profiles and related code lives in `lms/djangoapps/student/`. There is support for groups of students (e.g. 'want emails about future courses', 'have unenrolled', etc) in `lms/djangoapps/student/models.py`.
- `StudentModule` -- keeps track of where a particular student is in a module (problem, video, html)--what's their grade, have they started, are they done, etc. [This is only partly implemented so far.]
- `lms/djangoapps/courseware/models.py`
- Core rendering path:
- `lms/urls.py` points to `courseware.views.views.index`, which gets module info from the course xml file, pulls list of `StudentModule` objects for this user (to avoid multiple db hits).
- Calls `render_accordion` to render the "accordion"--the display of the course structure.
- To render the current module, calls `module_render.py:render_x_module()`, which gets the `StudentModule` instance, and passes the `StudentModule` state and other system context to the module constructor the get an instance of the appropriate module class for this user.
- calls the module's `.get_html()` method. If the module has nested submodules, render_x_module() will be called again for each.
- ajax calls go to `module_render.py:handle_xblock_callback()`, which passes it to one of the `XBlock`s handler functions
- See `lms/urls.py` for the wirings of urls to views.
- Tracking: there is support for basic tracking of client-side events in `lms/djangoapps/track`.
### CMS
The CMS is a django site, with root in `cms`. It can run in a number of different
environments, defined in `cms/envs`.
- Core rendering path: Still TBD
### Static file processing
- CSS -- we use a superset of CSS called SASS. It supports nice things like includes and variables, and compiles to CSS. The compiler is called `sass`.
- javascript -- we use coffeescript, which compiles to js, and is much nicer to work with. Look for `*.coffee` files. We use _jasmine_ for testing js.
- _mako_ -- we use this for templates, and have wrapper called edxmako that makes mako look like the django templating calls.
We use a fork of django-pipeline to make sure that the js and css always reflect the latest `*.coffee` and `*.sass` files (We're hoping to get our changes merged in the official version soon). This works differently in development and production. Test uses the production settings.
In production, the django `collectstatic` command recompiles everything and puts all the generated static files in a static/ dir. A starting point in the code is `django-pipeline/pipeline/packager.py:pack`.
In development, we don't use collectstatic, instead accessing the files in place. The auto-compilation is run via `common/djangoapps/pipeline_mako/templates/static_content.html`. Details: templates include `<%namespace name='static' file='static_content.html'/>`, then something like `<%static:css group='application'/>` to call the functions in `common/djangoapps/pipeline_mako/__init__.py`, which call the `django-pipeline` compilers.
## Testing
See `testing.rst`.
## TODO:
- describe our production environment
- describe the front-end architecture, tools, etc. Starting point: `lms/static`
---
Note: this file uses markdown. To convert to html, run:
markdown2 overview.md > overview.html
Grades can be pushed to a remote gradebook, and course enrollment membership can be pulled from a remote gradebook. This file documents how to setup such a remote gradebook, and what the API should be for writing new remote gradebook "xservers".
1. Definitions
An "xserver" is a web-based server that is part of the edX ecosystem. There are a number of "xserver" programs, including one which does python code grading, an xqueue server, and graders for other coding languages.
"Stellar" is the MIT on-campus gradebook system.
2. Setup
The remote gradebook xserver should be specified in the lms.envs configuration using
FEATURES[REMOTE_GRADEBOOK_URL]
Each course, in addition, should define the name of the gradebook being used. A class "section" may also be specified. This goes in the policy.json file, eg:
"remote_gradebook": {
"name" : "STELLAR:/project/edxdemosite",
"section" : "r01"
},
3. The API for the remote gradebook xserver is an almost RESTful service model, which only employs POSTs, to the xserver url, with form data for the fields:
- submit: get-assignments, get-membership, post-grades, or get-sections
- gradebook: name of gradebook
- user: username of staff person initiating the request (for logging)
- section: (optional) name of section
The return body content should be a JSON string, of the format {'msg': message, 'data': data}. The message is displayed in the instructor dashboard.
The data is a list of dicts (associative arrays). Each dict should be key:value.
## For submit=post-grades:
A file is also posted, with the field name "datafile". This file is CSV format, with two columns, one being "External email" and the other being the name of the assignment (that column contains the grades for the assignment).
## For submit=get-assignments
data keys = "AssignmentName"
## For submit=get-membership
data keys = "email", "name", "section"
## For submit=get-sections
data keys = "SectionName"
This document has moved to [testing.rst](./testing.rst).
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS ?= -W
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."
path.py
Django >=1.8,<1.9
django-simple-history==1.6.3
pytz
git+https://github.com/edx/XBlock.git#egg=XBlock
git+https://github.com/edx/django-rest-framework-oauth.git@f0b503fda8c254a38f97fef802ded4f5fe367f7a#egg=djangorestframework_oauth-master
lxml
Babel
lazy
sphinxcontrib-napoleon==0.2.6
sphinx_rtd_theme
stevedore==0.14.1
djangorestframework==3.2.3
PyYAML>=3.10
mock
django-model-utils==2.3.1
{% extends "!layout.html" %}
{% block header %}
<img src="{{ pathto("_static/homepage-bg.jpg", 1) }}" alt="Edx logo" width="100%;"/>
{% endblock %}
\ No newline at end of file
.. _edX API Authentication:
#############################
EdX API Authentication
#############################
*************
OAuth 2.0
*************
The edX Platform APIs use 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`_ for more information.
***************************************
Registering with Your Open edX Instance
***************************************
To use the edX Platform API with courses on your instance of Open edX, you must
register your application with the Open edX server. See the OAuth 2.0
specification for details.
.. include:: links.rst
############
Change Log
############
*****************
2015
*****************
.. list-table::
:widths: 10 70
:header-rows: 1
* - Date
- Change
* - 10 June 2015
- Added documentation for the profile images API.
* - 11 May 2015
- Updated the :ref:`User API <edX Platform User API>` to
Version 1.0.
* -
- Added the :ref:`User Preferences API`.
* - 23 April 2015
- Updated the example responses in the profile images API documentation.
* - 2 April 2015
- Added documentation for the course structure API, :ref:`edX
Platform Enrollment API` and edX Platform User API Version 0 sections.
* - 29 January 2015
- Added documentation about changing a user's status in a course to the
profile images API documentation.
# -*- 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 as path
import sys
import mock
MOCK_MODULES = [
'lxml',
'requests',
'xblock',
'xblock.fields',
'xblock.fragment',
'webob',
'webob.multidict',
'xblock.core',
'xblock.runtime',
'sortedcontainers',
'contracts',
'xblock.plugin',
'opaque_keys.edx.asides',
'dogstats_wrapper',
'fs',
'fs.errors',
'edxmako',
'edxmako.shortcuts',
'crum',
'opaque_keys.edx.locator',
'ipware',
'ipware.ip',
'pygeoip',
'ipaddr',
'django_countries',
'django_countries.fields',
'opaque_keys',
'opaque_keys.edx',
'opaque_keys.edx.keys',
'opaque_keys.edx.locations',
'courseware',
'courseware.access',
'courseware.model_data',
'courseware.module_render',
'courseware.views.views',
'util.request',
'eventtracking',
'xmodule',
'xmodule.exceptions',
'xmodule.modulestore',
'xmodule.modulestore.exceptions',
'xmodule.modulestore.django',
'xmodule.fields',
'courseware.models',
'milestones',
'milestones.api',
'milestones.models',
'milestones.exceptions',
'ratelimitbackend',
'analytics',
'courseware.courses',
'django.contrib.staticfiles',
'django.contrib.staticfiles.storage',
'xmodule.contentstore',
'xmodule.contentstore.content',
'xblock.exceptions',
'xmodule.seq_module',
'xmodule.vertical_module',
'xmodule.x_module',
'nltk',
'ratelimitbackend',
'ratelimitbackend.exceptions',
'social',
'social.apps',
'social.apps.django_app',
'social.backends',
'mako',
'mako.exceptions',
'boto',
'boto.exception',
'PIL',
'reportlab',
'reportlab.lib',
'pdfgen',
'pdfgen.canvas',
'reportlab.pdfgen',
'reportlab.pdfgen.canvas',
'reportlab.lib.pagesizes',
'reportlab.lib.units',
'reportlab.lib.styles',
'reportlab.platypus',
'reportlab.platypus.tables',
'boto.s3',
'boto.s3.connection',
'boto.s3.key',
'Crypto',
'Crypto.Cipher',
'Crypto.PublicKey',
'openid',
'openid.store',
'openid.store.interface',
'openedx.core.djangoapps.external_auth.views',
'mail_utils',
'ratelimitbackend.backends',
'social.apps.django_app.default',
'social.exceptions',
'social.pipeline',
'xmodule.error_module',
'accounts.api',
'modulestore.mongo.base',
'xmodule.modulestore.mongo',
'xmodule.modulestore.mongo.base',
'edxval',
'edxval.api',
'certificates',
'certificates.models',
'certificates.models.GeneratedCertificate',
'shoppingcart',
'shopppingcart.models',
'shopppingcart.api',
'api',
'student',
'student.views',
'student.forms',
'student.models',
'celery',
'celery.task',
'student.roles',
'openedx.core.djangoapps.embargo.models',
'xmodule.vertical_block',
'xmodule.course_module',
'user_api.accounts.api',
'user_api.accounts.serializers',
'edx_rest_api_client',
'edx_rest_api_client.client',
'edx_rest_api_client.exceptions',
'student.auth',
'ccx_keys',
'ccx_keys.locator',
'user_api.preferences.api',
'rest_framework_oauth.authentication',
'certificates.api',
'courseware.date_summary',
'rest_framework_jwt',
'rest_framework_jwt.authentication',
'microsite_configuration',
'xmodule.assetstore',
'xmodule.assetstore.assetmgr',
'xmodule.assetstore.assetmgr.AssetManager',
'xmodule.contentstore.django',
'piexif',
'provider',
'provider.oauth2',
'oauth2_provider',
'celery.signals',
'edx_rest_framework_extensions',
'edx_rest_framework_extensions.authentication',
'django_extensions',
'django_extensions.db',
'django_extensions.db.models',
'jsonfield',
'jsonfield.fields',
]
for mod_name in MOCK_MODULES:
sys.modules[mod_name] = mock.Mock()
if "DJANGO_SETTINGS_MODULE" not in os.environ:
docs_path = os.getcwd()
mezzanine_path_parts = (docs_path, "..")
sys.path.insert(0, docs_path)
sys.path.insert(0, os.path.realpath(os.path.join(*mezzanine_path_parts)))
os.environ["DJANGO_SETTINGS_MODULE"] = "docs_settings"
# Django 1.7's setup is required before touching translated strings.
import django
try:
django.setup()
except AttributeError: # < 1.7
pass
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
sys.path.append('../../../../')
os.environ['DJANGO_SETTINGS_MODULE'] = 'lms.envs.dev'
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lms.envs.dev")
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/lib/xmodule")
sys.path.append(root / "common/djangoapps")
sys.path.append(root / "lms/djangoapps")
sys.path.append(root / "lms/envs")
sys.path.append(root / "openedx/core/djangoapps")
sys.path.append(root / "openedx/features")
sys.path.insert(
0,
os.path.abspath(
os.path.normpath(
os.path.dirname(__file__) + '/../../../'
)
)
)
sys.path.append('.')
# 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']
project = 'Open edX Platform APIs'
exclude_patterns = ['build', 'links.rst']
.. _EdX Platform Course Structure API Version 0:
#############################################
Course Structure API Version 0 (Deprecated)
#############################################
The course structure API version 0 is deprecated. EdX platform developers
should not implement new client functions that use the course structure API
version 0.
You can get information about the courses offered by an edX platform
installation by using the ``/api/courses/v1/courses/`` REST endpoint.
You can get information about the parameters and return values of
``/api/courses/v1/courses`` from the Django REST framework web page for that
endpoint. For example, `https://courses.edx.org/api/courses/v1/courses/`_ provides information about the courses offered by edx.org.
.. note::
The documentation available at `docs.edx.org`_ does not include information
about the ``/api/courses/v1/courses/`` REST endpoint. Developer
documentation for the ``/api/courses/v1/courses/`` is planned in upcoming
documentation releases.
.. include:: ../links.rst
.. _Courses API Courses Resource:
########################################
Courses API Courses Resource
########################################
With the Courses API **Courses** resource, you can complete the
following tasks.
.. contents::
:local:
:depth: 1
.. _Get a list of courses:
**********************
Get a List of Courses
**********************
The endpoint to get a list of courses is ``/api/courses/v1/courses/``.
=====================
Use Case
=====================
Get a list of the courses that are visible to a specific user. If a username
is not supplied, an anonymous user is assumed. Users with course staff
permissions can specify other users' usernames.
=====================
Request Format
=====================
GET /api/courses/v1/courses/
Example:
GET /api/courses/v1/courses/?username=anjali
.. _Courses Query Parameters:
=====================
Query Parameters
=====================
* username (optional) - The username of the user for whom the course data is
being accessed. If the request is made for an anonymous user, username is
not required. Only users with course staff permissions can specify other
users' usernames.
* org (optional) - A code for an organization; case-insensitive. Example:
"HarvardX". If ``org`` is specified, the list of courses includes only
courses that belong to the specified organization.
* mobile (optional) - If specified, the list of courses includes only courses
that are designated as ``mobile_available``.
.. _Courses Response Values:
=====================
Response Values
=====================
The following fields are returned with a successful response.
All date/time fields are in ISO 8601 notation.
* effort: A textual description of the weekly hours of effort expected in the
course.
* end: The date and time that the course ends.
* enrollment_end: The date and time that enrollment ends.
* enrollment_start: The date and time that enrollment begins.
* id: A unique identifier of the course; a serialized representation of the
opaque key identifying the course.
* media: An object that contains named media items, including the following
objects.
* course_image: An image to show for the course.
* uri: The location of the image.
* course_video: A video about the course.
* uri: The location of the video.
* name: The name of the course.
* number: The catalog number of the course.
* org: The name of the organization that owns the course.
* overview: An HTML textual description of the course.
* short_description: A textual description of the course.
* start: The date and time that the course begins.
* start_display: The start date of the course, formatted for reading.
* start_type: Indicates how ``start_display`` was set. Possible values are:
* "string": Manually set by the course author.
* "timestamp": Generated from the ``start`` timestamp.
* "empty": No start date is specified.
* pacing: The type of pacing for this course. Possible values are
``instructor`` and ``self``.
* course_id: The course key. This field might be returned but is deprecated.
You should use ``id`` instead.
==============================================================
Example Response Showing The List of Courses Visible to a User
==============================================================
.. code-block:: json
{
"media": {
"course_image": {
"uri": "/c4x/edX/example/asset/just_a_test.jpg",
"name": "Course Image"
}
},
"description": "An example course.",
"end": "2015-09-19T18:00:00Z",
"enrollment_end": "2015-07-15T00:00:00Z",
"enrollment_start": "2015-06-15T00:00:00Z",
"id": "edX/example/2012_Fall",
"name": "Example Course",
"number": "example",
"org": "edX",
"start": "2015-07-17T12:00:00Z",
"start_display": "July 17, 2015",
"start_type": "timestamp"
}
.. _Get the details for a course:
*************************
Get Details for a Course
*************************
The endpoint to get the details for a course is
``/api/courses/v1/courses/{course_key}/``.
=====================
Use Case
=====================
Get the details for a course that you specify using a course key.
=====================
Request Format
=====================
GET /api/courses/v1/courses/{course_key}
Example:
GET /api/courses/v1/courses/edX%2FDemoX%2FDemo_Course
=====================
Query Parameters
=====================
* username (optional) - The username of the user for whom the course data is
being accessed. If the request is made for an anonymous user, username is
not required. Only users with course staff permissions can specify other
users' usernames.
=====================
Response Values
=====================
:ref:`Response values<Courses Response Values>` for this endpoint are the same
as those for :ref:`Get a list of courses`.
=========================================================
Example Response Showing Details of a Specified Course
=========================================================
The following example response is returned from this request:
GET /api/courses/v1/courses/edX%2FDemoX%2FDemo_Course
.. code-block:: json
{
"effort": null,
"end": "2015-08-08T00:00:00Z",
"enrollment_start": "2015-01-01T00:00:00Z",
"enrollment_end": "2015-05-01T00:00:00Z",
"id": "edX/DemoX/Demo_Course",
"media": {
"course_image": {
"uri": "/c4x/edX/DemoX/asset/images_course_image.jpg"
},
"course_video": {
"uri": null
},
},
"name": "edX Demonstration Course",
"number": "DemoX",
"org": "edX",
"short_description": null,
"start": "2015-02-05T05:00:00Z",
"start_display": "Feb. 5, 2015",
"start_type": "timestamp",
"pacing": "instructor",
"course_id": "edX/DemoX/Demo_Course",
"overview": "<p>Include your long course description here.</p>"
}
.. _edX Platform Courses API:
#####################################
Courses API Version 1.0
#####################################
.. toctree::
:maxdepth: 2
overview
courses
blocks
.. _Courses API Overview:
#############################
Courses API Overview
#############################
Use the Courses API to obtain information about edX courses.
.. contents::
:local:
:depth: 1
*****************************************
Courses API Version and Status
*****************************************
The Courses API is currently at version 1.0.
************************************
Courses API Resources and Endpoints
************************************
The Courses API includes the :ref:`Courses<Courses API Courses Resource>` and
:ref:`Blocks<Courses API Blocks Resource>` resources, and supports the following
tasks, methods, and endpoints.
=================
Courses Resource
=================
.. list-table::
:widths: 20 10 70
:header-rows: 1
* - Task
- Method
- Endpoint
* - :ref:`Get a list of courses`
- GET
- /api/courses/v1/courses/
* - :ref:`Get the details for a course`
- GET
- /api/courses/v1/courses/{course_key}/
=================
Blocks Resource
=================
.. list-table::
:widths: 20 10 70
:header-rows: 1
* - Task
- Method
- Endpoint
* - :ref:`Get a list of the course blocks in a course`
- GET
- /api/courses/v1/blocks/ with required ``course_id`` parameter
* - :ref:`Get a list of the course blocks in a block tree`
- GET
- /api/courses/v1/blocks/{usage_id}
"""
This is the local_settings file for platform API doc.
"""
# Generate a SECRET_KEY for this build
from random import choice
characters = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
SECRET_KEY = ''.join([choice(characters) for i in range(50)])
# for use in openedx/core/djangoapps/profile_images/images.py
PROFILE_IMAGE_MAX_BYTES = 1000
PROFILE_IMAGE_MIN_BYTES = 1000
###################################
Enrollment API Enrollment Resource
###################################
With the Enrollment API **Enrollment** resource, you can complete the
following tasks.
.. contents::
:local:
:depth: 1
.. _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:: none
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",
"course_name": "edX Demonstration 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 the User's Enrollment Information for a Course
**************************************************
.. autoclass:: enrollment.views.EnrollmentCourseDetailView
**Example response showing a user's course enrollment information**
.. code-block:: none
HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, HEAD, OPTIONS
{
"course_id": "edX/DemoX/Demo_Course",
"course_name": "edX Demonstration 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 a User's Enrollments or Enroll a User in a Course
**********************************************************
.. autoclass:: enrollment.views.EnrollmentListView
**Example response showing a user who is enrolled in two courses**
.. code-block:: none
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",
"course_name": "edX Demonstration 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",
"course_name": "Course Name Here",
"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 response showing that a user has been enrolled in a new course**
.. code-block:: json
{
"course_details": {
"course_id": "edX/DemoX/Demo_Course"
}
}
.. _edX Platform Enrollment API:
########################################
Enrollment API Version 1.0
########################################
.. toctree::
:maxdepth: 2
overview
enrollment
.. _edX Enrollment API Overview:
################################################
Enrollment API Overview
################################################
Use the Enrollment API to view user and course enrollment
information and to enroll a user in a course.
.. contents::
:local:
:depth: 1
****************************************
Enrollment API Version and Status
****************************************
The Enrollment API is currently at version 1.0. We plan to make
significant enhancements to this API.
********************************************
Enrollment API Endpoints
********************************************
The Enrollment API supports the following tasks, methods, and endpoints.
.. list-table::
:widths: 20 10 70
:header-rows: 1
* - Task
- Method
- Endpoint
* - :ref:`Get the user's enrollment status in a course <Get the Users Enrollment Status in a Course>`
- GET
- /api/enrollment/v1/enrollment/{user_id},{course_id}
* - :ref:`Get the user's enrollment information for a course <Get Enrollment Details for a Course>`
- GET
- /api/enrollment/v1/course/{course_id}
* - :ref:`View a user's enrollments <View and add to a Users Course Enrollments>`
- GET
- /api/enrollment/v1/enrollment
* - :ref:`Enroll a user in a course <View and add to a Users Course Enrollments>`
- POST
- /api/enrollment/v1/enrollment{"course_details":{"course_id":"{course_id}"}}
.. _Open edX Platform APIs:
#######################
Open edX Platform APIs
#######################
.. toctree::
:titlesonly:
read_me
preface
change_log
.. toctree::
:maxdepth: 2
overview
authentication
****************
Supported APIs
****************
.. toctree::
:maxdepth: 2
courses/index
enrollment/index
user/index
******************
Deprecated APIs
******************
.. toctree::
:maxdepth: 2
course_structure/index
mobile/index
profile_images/index
.. _OAuth 2.0 Standard: https://tools.ietf.org/html/draft-ietf-oauth-v2-31
.. _docs.edx.org: http://docs.edx.org/
.. _https://courses.edx.org/api/courses/v1/courses/: https://courses.edx.org/api/courses/v1/courses/
.. _edX Platform Mobile API Version 0.5:
#####################################
Mobile API Version 0.5 (Deprecated)
#####################################
The mobile API version 0.5 is deprecated. EdX platform developers should not
implement new client functions that use the mobile API version 0.5.
You can get information about the courses offered by an edX platform
installation by using the ``/api/courses/v1/courses/`` REST endpoint.
You can get information about the parameters and return values of
``/api/courses/v1/courses`` from the Django REST framework web page for that
endpoint. For example, `https://courses.edx.org/api/courses/v1/courses/`_
provides information about the courses offered by edx.org.
.. note::
The documentation available at `docs.edx.org`_ does not include information
about the ``/api/courses/v1/courses/`` REST endpoint. Developer
documentation for the ``/api/courses/v1/courses/`` is planned in upcoming
documentation releases.
You can get and update information about learners by using the edX platform
user API. For more information about getting and updating learner information
in the user API, see :ref:`Get and Update the User's Account Information`.
.. include:: ../links.rst
################################################
Overview of the edX Platform APIs
################################################
The edX Platform APIs are a rapidly growing and evolving set of capabilities
that enable you to build web, desktop, and mobile applications that work with
your Open edX instance.
The edX Platform APIs use REST design principles and support the JSON data-
interchange format. The APIs also use edX OAuth 2.0 for :ref:`authentication
<edX API Authentication>`.
**********************************************
Supported edX Platform API Modules
**********************************************
The following edX Platform APIs are currently supported.
* :ref:`edX Platform Courses API`
* :ref:`edX Platform Enrollment API`
* :ref:`edX Platform User API`
.. include:: ../../shared/preface.rst
\ No newline at end of file
.. _Profile Images API Version 1.0:
###########################################
Profile Images API Version 1.0 (Deprecated)
###########################################
The profile images API version 1.0 is deprecated. EdX platform developers
should not implement new client functions that use the profile images API
version 1.0.
You can get and update learners' profile images by using the edX platform user
API. The ``profile_image`` object is included in the JSON information for a
learner. For more information about getting and updating profile images in the
user API, see :ref:`Get and Update the User's Account Information`.
.. include:: ../links.rst
########
Read Me
########
The edX Platform 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/en_us/platform_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
.. _User Accounts API:
##################################################
User API User Accounts Resource
##################################################
With the User API **User Accounts** resource, you can complete the following
tasks.
.. contents::
:local:
:depth: 1
.. _Get and Update the User's Account Information:
**********************************************
Get and Update a User's Account Information
**********************************************
.. autoclass:: user_api.accounts.views.AccountViewSet
**Example response showing a user's account information**
.. code-block:: none
HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, HEAD, OPTIONS, PATCH
{
"username": "John",
"name": "John Doe",
"language": "",
"gender": "m",
"year_of_birth": 1987,
"level_of_education": "m",
"goals": "Professional Development",
"country": US,
"mailing_address": "123 Main Street, Anytown, MA 02144",
"email": "johndoe@company.com",
"date_joined": "2015-03-18T13:42:40Z",
"account_privacy": "all_users"
}
.. _edX Platform User API:
#################################
User API Version 1.0
#################################
.. toctree::
:maxdepth: 2
overview
accounts
preferences
################################################
User API Overview
################################################
Use the User API to view and update account and preference information.
.. contents::
:local:
:depth: 1
*************************************
User API Version and Status
*************************************
The User API is currently at version 1.0. We plan on making
significant enhancements to this API.
**********************************************
User API Resources and Endpoints
**********************************************
The User API supports the following resources, tasks, methods, and endpoints.
=============================
User Accounts API Resource
=============================
.. list-table::
:widths: 20 10 70
:header-rows: 1
* - Task
- Method
- Endpoint
* - :ref:`Get a user's account information <Get and Update the User's
Account Information>`
- GET
- /api/user/v1/accounts/{username}/[?view=shared]
* - :ref:`Update your account information <Get and Update the User's Account
Information>`
- PATCH
- /api/user/v1/accounts/{username}/{“key”:”value”}
=============================
User Preferences API Resource
=============================
.. list-table::
:widths: 20 10 70
:header-rows: 1
* - Task
- Method
- Endpoint
* - :ref:`Get a user's preferences information
<Get and Update the User's Preferences Information>`
- GET
- /api/user/v1/preferences/{username}/
* - :ref:`Update a user's preferences information
<Get and Update the User's Preferences Information>`
- PATCH
- /api/user/v1/preferences/{username}/
* - :ref:`Get a specific preference
<Get Update or Delete a Specific Preference>`
- GET
- /api/user/v1/preferences/{username}/{preference_key}
* - :ref:`Update a specific preference
<Get Update or Delete a Specific Preference>`
- PUT
- /api/user/v1/preferences/{username}/{preference_key}
* - :ref:`Delete a specific preference
<Get Update or Delete a Specific Preference>`
- DELETE
- /api/user/v1/preferences/{username}/{preference_key}
.. _User Preferences API:
##################################################
User API User Preferences Resource
##################################################
With the User API **User Preferences** resource, you can complete the
following tasks.
.. contents::
:local:
:depth: 1
.. _Get and Update the User's Preferences Information:
**************************************************
Get and Update the User's Preferences Information
**************************************************
.. autoclass:: user_api.preferences.views.PreferencesView
**Example response showing the user's preference information**
.. code-block:: none
HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, HEAD, OPTIONS, PATCH
{
"pref-lang": "en",
"account_privacy": "private"
}
.. _Get Update or Delete a Specific Preference:
**************************************************
Get, Update, or Delete a Specific Preference
**************************************************
.. autoclass:: user_api.preferences.views.PreferencesDetailView
**Example response to a request for the user's account_privacy setting**
.. code-block:: none
HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, HEAD, OPTIONS, PATCH
"private"
.. _Browsers:
####################
edX Browser Support
####################
.. Doc team! Be sure that when you make any changes to this file that you also make them to the mirrored files in these other locations.
.. edx-analytics-dashboard/docs/en_us/dashboard/source/front_matter
.. edx-platform/docs/en_us/shared
.. Alison 19 Aug 14
The edX platform runs on the following browsers.
* `Chrome`_
* `Safari`_
* `Firefox`_
* `Microsoft Edge`_ and `Microsoft Internet Explorer`_ 11
The edX platform is routinely tested and verified on the current version and
the previous version of each of these browsers. We generally encourage the use
of, and fully support only, the latest version.
.. note:: If you use the Safari browser, be aware that it does not support the
search feature for the guides on `docs.edx.org`_. This is a known limitation.
.. _docs.edx.org: http://docs.edx.org
.. Browsers
.. _Chrome: https://www.google.com/chrome
.. _Safari: https://www.apple.com/safari
.. _Firefox: https://mozilla.org/firefox
.. _Microsoft Edge: https://www.microsoft.com/microsoft-edge
.. _Microsoft Internet Explorer: http://windows.microsoft.com/internet-explorer/download-ie
##########################
edx-platform Documentation
##########################
Developer documentation for `edx-platform` can be found in the following
locations.
* The `edx-platform docs directory`_ contains some local developer
documentation.
* The `Developer Documentation Index`_ in Confluence provides additional links
to developer documentation for this and other projects. The rest of the `Open
edX Development space`_ in Confluence provides additional documentation.
* User documentation and a more general Developer's Guide can be read on `Open
edX ReadTheDocs`_. The source for these guides can be found in the
`edx-documentation`_ repository.
.. _edx-platform docs directory: https://github.com/edx/edx-platform/tree/master/docs
.. _Developer Documentation Index: https://openedx.atlassian.net/wiki/display/OpenDev/Developer+Documentation
.. _Open edX Development space: https://openedx.atlassian.net/wiki/display/OpenDev/Open+edX+Development
.. _Open edX ReadTheDocs: http://docs.edx.org/
.. toctree::
:maxdepth: 2
Change History
**************
* May, 2017: The local docs directory was cleared out to start fresh.
* January 13, 2015: The "edX Developer's Guide" was moved to
`edx-documentation`_.
* November 3, 2014: The documentation for several sub-projects were moved into
`edx-documentation`_.
.. _edx-documentation: https://github.com/edx/edx-documentation
# Read the docs requirements file
# ----------------------------------------
# Installing modules with C dependencies on RTD can be tricky, and pip doesn't
# have an 'ignore-errors' option, so all requirements fail. Here we keep the
# maximal list of modules that still works.
#
beautifulsoup4==4.1.3
beautifulsoup==3.2.1
boto==2.6.0
celery==3.0.19
distribute>=0.6.28, <0.7
django-celery==3.0.17
django-countries==4.0
django-filter==0.11.0
django-mako==0.1.5pre
django-mptt==0.5.5
django-openid-auth==0.4
django-sekizai==0.8.2
django-ses==0.7.0
django-storages==1.1.5
django-method-override==0.1.0
djangorestframework==2.3.5
django==1.4.5
feedparser==5.1.3
# Master pyfs has a bug working with VPC auth. This is a fix. We should switch
# back to master when and if this fix is merged back.
# fs==0.4.0
git+https://github.com/pmitros/pyfs.git@96e1922348bfe6d99201b9512a9ed946c87b7e0b
GitPython==0.3.2.RC1
glob2==0.3
lxml==3.4.4
mako==0.7.3
Markdown==2.2.1
mock==1.0.1
networkx==1.7
nltk==2.0.5
oauthlib==0.6.3
paramiko==1.9.0
path.py==7.2
Pillow==2.6.1
pip>=1.3
polib==1.0.3
pycrypto>=2.6
pygments==1.5
pymongo==2.4.1
python-memcached==1.48
python-openid==2.2.5
pytz==2016.7
PyYAML==3.10
requests==2.3.0
Shapely==1.2.16
sorl-thumbnail==12.3
sympy==0.7.1
xmltodict==0.4.1
# Metrics gathering and monitoring
dogapi==1.2.1
dogstatsd-python==0.2.1
newrelic==1.13.1.31
# Used for Internationalization and localization
Babel==1.3
transifex-client==0.9.1
-e common/lib/calc
-e common/lib/capa
-e common/lib/chem
-e common/lib/sandbox-packages
-e common/lib/symmath
-e common/lib/xmodule
-e .
-e git+https://github.com/edx/XBlock.git@b697bebd45deebd0f868613fab6722a0460ca0c1#egg=XBlock
...@@ -3117,7 +3117,7 @@ REDIRECT_CACHE_KEY_PREFIX = 'redirects' ...@@ -3117,7 +3117,7 @@ REDIRECT_CACHE_KEY_PREFIX = 'redirects'
############## Settings for LMS Context Sensitive Help ############## ############## Settings for LMS Context Sensitive Help ##############
HELP_TOKENS_INI_FILE = REPO_ROOT / "docs" / "lms_config.ini" HELP_TOKENS_INI_FILE = REPO_ROOT / "lms" / "envs" / "help_tokens.ini"
HELP_TOKENS_BOOKS = { HELP_TOKENS_BOOKS = {
'learner': 'http://edx.readthedocs.io/projects/open-edx-learner-guide', 'learner': 'http://edx.readthedocs.io/projects/open-edx-learner-guide',
'course_author': 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course', 'course_author': 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment