Commit cbeba972 by Sylvia Pearce Committed by Carol Tong

Add info about Catalog resource

parent 30844cf4
########################################
Course Catalog API Catalog Resource
########################################
With the Course Catalog API **Catalog** resource, you can complete the
following tasks.
.. contents::
:local:
:depth: 1
.. _Get a List of All Catalogs:
***************************
Get a List of All Catalogs
***************************
.. class enrollment.views.EnrollmentView(**kwargs)[source] (?)
===============
Use Case
===============
Get a list of all catalogs.
===============
Example Request
===============
``GET api/v1/catalogs/``
===============
Response Values
===============
If the request for information about the user is successful, an HTTP 200 “OK”
response is returned.
The HTTP 200 response has the following values.
* count
* next
* previous
* results
* courses_count
* id
* name
* query
* viewers
Example response showing a catalog of select courses
****************************************************
.. code-block:: json
HTTP 200 OK
{
"Date": "Wed, 20 Apr 2016 19:45:55 GMT",
"Content-Encoding": "gzip",
"Allow": "GET, POST, HEAD, OPTIONS",
"Server": "nginx/1.8.1",
"X-Frame-Options": "SAMEORIGIN",
"Vary": "Accept-Encoding, Accept, Accept-Language, Cookie",
"Content-Language": "en",
"Connection": "keep-alive",
"Content-Type": "application/json",
"Content-Length": "199"
}
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "All MITx and HarvardX Courses",
"query": "{\r\n \"query\": {\r\n \"query_string\": {\r\n \"query\": \"org:(MITx OR HarvardX)\",\r\n \"analyze_wildcard\": true\r\n }\r\n }\r\n}",
"courses_count": 0,
"viewers": []
}
]
}
.. _Create a New Catalog:
***************************
Create a New Catalog
***************************
.. class enrollment.views.EnrollmentView(**kwargs)[source] (?)
===============
Use Case
===============
Create a new catalog.
===============
Example Request
===============
``POST api/v1/catalogs/``
===============
Parameters
===============
.. list-table::
:widths: 25 25 50
:header-rows: 1
* - Parameter Name
- Required
- Description
- Parameter Type
- Data Type
* - name
- Yes
- Catalog name.
- form
- string
* - query
- Yes
- Query to retrieve catalog contents.
- form
- string
* - viewers
- No
- Usernames of users with explicit access to view this catalog.
- form
- string
===============
Response Values
===============
If the request for information about the user is successful, an HTTP "201
CREATED" response is returned.
The HTTP 201 response has the following values.
* courses_count
* id
* name
* query
* viewers
Example response creating a new catalog
***************************************
.. code-block:: json
HTTP 201 CREATED
{
"Date": "Wed, 20 Apr 2016 20:45:09 GMT",
"Allow": "GET, POST, HEAD, OPTIONS",
"Server": "nginx/1.8.1",
"X-Frame-Options": "SAMEORIGIN",
"Vary": "Accept, Accept-Language, Cookie",
"Content-Language": "en",
"Content-Type": "application/json",
"Connection": "keep-alive",
"Content-Length": "79"
}
{
"id": 2,
"name": "example_catalog",
"query": "example",
"courses_count": 6,
"viewers": []
}
.. _Get Details About a Catalog:
***************************
Get Details About a Catalog
***************************
.. class enrollment.views.EnrollmentView(**kwargs)[source] (?)
===============
Use Case
===============
Get details about a catalog.
===============
Example Request
===============
``GET api/v1/catalogs/{id}``
===============
Parameters
===============
.. list-table::
:widths: 25 25 50
:header-rows: 1
* - Parameter Name
- Required
- Description
- Parameter Type
- Data Type
* - ``id``
- Yes
- ******DESCRIPTION NEEDED******
- path
- string
===============
Response Values
===============
If the request for information about the user is successful...
......@@ -7,7 +7,7 @@ Course Catalog API Version 1.0
.. toctree::
:maxdepth: 2
course_field_specification
course_run_field_specification
supporting_object_field_specification
catalog
course_runs
course
#########################################################
Course Catalog API Course Field Specification Resource
#########################################################
*************************
*************************
All of the text in this file is placeholder text for formatting. Need more information at https://docs.google.com/document/d/11b8Qty8S7GF55QP-yagKi3zdAZGYd-gWYLEwBwxLZQk/edit before I can proceed.
*************************
*************************
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:: 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 the User's Enrollment Information for a Course
**************************************************
.. autoclass:: enrollment.views.EnrollmentCourseDetailView
**Example response showing a user's course enrollment information**
.. 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 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:: 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 response showing that a user has been enrolled in a new course**
.. code-block:: json
{
"course_details": {
"course_id": "edX/DemoX/Demo_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