Course Information API#

Get Weekly Course Activity#

class analytics_data_api.v0.views.courses.CourseActivityWeeklyView(**kwargs)[source]#

Get counts of users who performed specific activities in a course.

Example request

GET /api/v0/courses/{course_id}/activity/

Response Values

Returns a list of key/value pairs for student activities, as well as the interval start and end dates and the course ID.

  • any: The number of unique users who performed any action in the course, including actions not counted in other categories in the response.

  • attempted_problem: The number of unique users who answered any loncapa-based problem in the course.

  • played_video: The number of unique users who started watching any video in the course.

  • posted_forum: The number of unique users who created a new post, responded to a post, or submitted a comment on any discussion in the course.

  • interval_start: The time and date at which data started being included in returned values.

  • interval_end: The time and date at which data stopped being included in returned values.

  • course_id: The ID of the course for which data is returned.

  • created: The date the counts were computed.

Parameters

You can specify the start and end dates for the time period for which you want to get activity.

You specify dates in the format: YYYY-mm-ddTtttttt; for example, 2014-12-15T000000.

If no start or end dates are specified, the data for the week ending on the previous day is returned.

start_date – Date after which all data is returned (inclusive).

end_date – Date before which all data is returned (exclusive).

Example Response

HTTP 200 OK
Vary: Accept
Content-Type: text/html; charset=utf-8
Allow: GET, HEAD, OPTIONS

[
  {
    "interval_start": "2014-12-08T000000",
    "interval_end": "2014-12-15T000000",
    "course_id": "edX/DemoX/Demo_Course",
    "any": 3013,
    "attempted_problem": 206,
    "played_video": 1049,
    "created": "2014-12-10T193104"
  }
]

Get Recent Course Activity#

class analytics_data_api.v0.views.courses.CourseActivityMostRecentWeekView(**kwargs)[source]#

Get counts of users who performed specific activities at least once during the most recently computed week.

Example request

GET /api/v0/courses/{course_id}/recent_activity/

Response Values

Returns a list of key/value pairs for student activities, as well as the interval start and end dates and the course ID.

  • activity_type: The type of activity counted. Possible values are:

    • any: The number of unique users who performed any action in the course, including actions not counted in other categories in the response.

    • attempted_problem: The number of unique users who answered any loncapa-based problem in the course.

    • played_video: The number of unique users who started watching any video in the course.

    • posted_forum: The number of unique users who created a new post, responded to a post, or submitted a comment on any discussion in the course.

  • count: The number of unique users who performed the specified action.

  • interval_start: The time and date at which data started being included in returned values.

  • interval_end: The time and date at which data stopped being included in returned values.

  • course_id: The ID of the course for which data is returned.

Parameters

You can specify the activity type for which you want to get the count.

activity_type – The type of activity: any (default), attempted_problem, played_video, posted_forum.

Example Response

HTTP 200 OK
Vary: Accept
Content-Type: text/html; charset=utf-8
Allow: GET, HEAD, OPTIONS

{
  "interval_start": "2014-12-08T00:00:00Z",
  "interval_end": "2014-12-15T00:00:00Z",
  "activity_type": "any",
  "count": 3013,
  "course_id": "edX/DemoX/Demo_Course"
}

Get the Course Enrollment#

class analytics_data_api.v0.views.courses.CourseEnrollmentView(**kwargs)[source]#

Get the number of enrolled users.

Example request

GET /api/v0/courses/{course_id}/enrollment/

Response Values

Returns the count of enrolled users:

  • course_id: The ID of the course for which data is returned.

  • date: The date for which the enrollment count was computed.

  • count: The count of enrolled users.

  • created: The date the count was computed.

Parameters

You can specify the start and end dates for which to count enrolled users.

You specify dates in the format: YYYY-mm-dd; for example, 2014-12-15.

If no start or end dates are specified, the data for the previous day is returned.

start_date – Date after which enrolled students are counted (inclusive).

end_date – Date before which enrolled students are counted (exclusive).

Example Response

HTTP 200 OK
Vary: Accept
Content-Type: text/html; charset=utf-8
Allow: GET, HEAD, OPTIONS
[
  {
    "course_id": "edX/DemoX/Demo_Course",
    "date": "2014-12-10",
    "count": 1892,
    "created": "2014-12-10T193146"
  }
]

Get the Course Enrollment by Mode#

class analytics_data_api.v0.views.courses.CourseEnrollmentModeView(**kwargs)[source]#

Get the number of enrolled users by enrollment mode.

Example request

GET /api/v0/courses/{course_id}/enrollment/mode/

Response Values

Returns the counts of users by mode:

  • course_id: The ID of the course for which data is returned.

  • date: The date for which the enrollment count was computed.

  • count: The count of currently enrolled users.

  • cumulative_count: The cumulative total of all users ever enrolled.

  • created: The date the counts were computed.

  • honor: The number of users currently enrolled in honor code mode.

  • professional: The number of users currently enrolled in professional mode.

  • verified: The number of users currently enrolled in verified mode.

Parameters

You can specify the start and end dates for which to count enrolled users.

You specify dates in the format: YYYY-mm-dd; for example, 2014-12-15.

If no start or end dates are specified, the data for the previous day is returned.

start_date – Date after which enrolled students are counted (inclusive).

end_date – Date before which enrolled students are counted (exclusive).

Example Response

HTTP 200 OK
Vary: Accept
Content-Type: text/html; charset=utf-8
Allow: GET, HEAD, OPTIONS

[
  {
    "course_id": "edX/DemoX/Demo_Course",
    "date": "2014-12-10",
    "count": 1890,
    "cumulative_count": 1931,
    "created": "2014-12-10T193146",
    "honor": 945,
    "professional": 189,
    "verified": 756
  }
]

Get the Course Enrollment by Birth Year#

class analytics_data_api.v0.views.courses.CourseEnrollmentByBirthYearView(**kwargs)[source]#

Get the number of enrolled users by birth year.

Example request

GET /api/v0/courses/{course_id}/enrollment/birth_year/

Response Values

Returns an array with a collection for each year in which a user was born. Each collection contains:

  • course_id: The ID of the course for which data is returned.

  • date: The date for which the enrollment count was computed.

  • birth_year: The birth year for which the enrollment count applies.

  • count: The number of users who were born in the specified year.

  • created: The date the count was computed.

Parameters

You can specify the start and end dates for which to count enrolled users.

You specify dates in the format: YYYY-mm-dd; for example, 2014-12-15.

If no start or end dates are specified, the data for the previous day is returned.

start_date – Date after which enrolled students are counted (inclusive).

end_date – Date before which enrolled students are counted (exclusive).

Example Response

HTTP 200 OK
Vary: Accept
Content-Type: text/html; charset=utf-8
Allow: GET, HEAD, OPTIONS

[
  {
    "course_id": "edX/DemoX/Demo_Course",
    "date": "2014-12-10",
    "birth_year": 1960,
    "count": 11,
    "created": "2014-12-10T193146"
  },
  {
    "course_id": "edX/DemoX/Demo_Course",
    "date": "2014-12-10",
    "birth_year": 1961,
    "count": 58,
    "created": "2014-12-10T193146"
  }
]

Get the Course Enrollment by Education Level#

class analytics_data_api.v0.views.courses.CourseEnrollmentByEducationView(**kwargs)[source]#

Get the number of enrolled users by education level.

Example request

GET /api/v0/courses/{course_id}/enrollment/education/

Response Values

Returns a collection for each level of education reported by a user. Each collection contains:

  • course_id: The ID of the course for which data is returned.

  • date: The date for which the enrollment count was computed.

  • education_level: The education level for which the enrollment count applies.

  • count: The number of userswho reported the specified education level.

  • created: The date the count was computed.

Parameters

You can specify the start and end dates for which to count enrolled users.

You specify dates in the format: YYYY-mm-dd; for example, 2014-12-15.

If no start or end dates are specified, the data for the previous day is returned.

start_date – Date after which enrolled students are counted (inclusive).

end_date – Date before which enrolled students are counted (exclusive).

Example Response

HTTP 200 OK
Vary: Accept
Content-Type: text/html; charset=utf-8
Allow: GET, HEAD, OPTIONS

[
  {
    "course_id": "edX/DemoX/Demo_Course",
    "date": "2014-12-10",
    "education_level": "bachelors",
    "count": 634,
    "created": "2014-12-10T193146"
  },
  {
    "course_id": "edX/DemoX/Demo_Course",
    "date": "2014-12-10",
    "education_level": "doctorate",
    "count": 88,
    "created": "2014-12-10T193146"
  }
]

Get the Course Enrollment by Gender#

class analytics_data_api.v0.views.courses.CourseEnrollmentByGenderView(**kwargs)[source]#

Get the number of enrolled users by gender.

Example request

GET /api/v0/courses/{course_id}/enrollment/gender/

Response Values

Returns the count of each gender specified by users:

  • course_id: The ID of the course for which data is returned.

  • date: The date for which the enrollment count was computed.

  • female: The count of self-identified female users.

  • male: The count of self-identified male users.

  • other: The count of self-identified other users.

  • unknown: The count of users who did not specify a gender.

  • created: The date the counts were computed.

Parameters

You can specify the start and end dates for which to count enrolled users.

You specify dates in the format: YYYY-mm-dd; for example, 2014-12-15.

If no start or end dates are specified, the data for the previous day is returned.

start_date – Date after which enrolled students are counted (inclusive).

end_date – Date before which enrolled students are counted (exclusive).

Example Response

HTTP 200 OK
Vary: Accept
Content-Type: text/html; charset=utf-8
Allow: GET, HEAD, OPTIONS

[
  {
    "course_id": "edX/DemoX/Demo_Course",
    "date": "2014-12-10",
    "female": 732,
    "male": 1155,
    "other": 435,
    "unknown": 0,
    "created": "2014-12-10T193146"
  }
]

Get the Course Enrollment by Location#

class analytics_data_api.v0.views.courses.CourseEnrollmentByLocationView(**kwargs)[source]#

Get the number of enrolled users by location.

Location is calculated based on the user’s IP address. Users whose location cannot be determined are counted as having a country.name of UNKNOWN.

Countries are denoted by their ISO 3166 country code.

Example request

GET /api/v0/courses/{course_id}/enrollment/location/

Response Values

Returns counts of genders specified by users:

  • course_id: The ID of the course for which data is returned.

  • date: The date for which the enrollment count was computed.

  • country: Contains the following fields:

    • alpha2: The two-letter country code.

    • alpha3: The three-letter country code.

    • name: The country name.

  • count: The count of users from the country.

  • created: The date the count was computed.

Parameters

You can specify the start and end dates for which to count enrolled users.

You specify dates in the format: YYYY-mm-dd; for example, 2014-12-15.

If no start or end dates are specified, the data for the previous day is returned.

start_date – Date after which enrolled students are counted (inclusive).

end_date – Date before which enrolled students are counted (exclusive).

See ISO 3166 country codes for more information.

Example Response

HTTP 200 OK
Vary: Accept
Content-Type: text/html; charset=utf-8
Allow: GET, HEAD, OPTIONS

[
  {
    "date": "2014-12-10",
    "course_id": "edX/DemoX/Demo_Course",
    "country": {
      "alpha2": "CA",
      "alpha3": "CAN",
      "name": "Canada"
    },
    "count": 264,
    "created": "2014-12-10T193146"
  },
  {
    "date": "2014-12-10",
    "course_id": "edX/DemoX/Demo_Course",
    "country": {
      "alpha2": "CN",
      "alpha3": "CHN",
      "name": "China"
    },
    "count": 416,
    "created": "2014-12-10T193146"
  }
]

Get the Course Video Data#

class analytics_data_api.v0.views.courses.VideosListView(**kwargs)[source]#

Get data for the videos in a course.

Example request

GET /api/v0/courses/{course_id}/videos/

Response Values

Returns a collection of video views and metadata for each video. For each video, the collection the following data.

  • video_id: The ID of the video.

  • encoded_module_id: The encoded module ID.

  • duration: The length of the video in seconds.

  • segment_length: The length of each segment of the video in seconds.

  • users_at_start: The number of viewers at the start of the video.

  • users_at_end: The number of viewers at the end of the video.

  • created: The date the video data was updated.

Example Response

HTTP 200 OK
Vary: Accept
Content-Type: text/html; charset=utf-8
Allow: GET, HEAD, OPTIONS

[
  {
    "pipeline_video_id": "UniversityX/UX.3.01x/1T2015|i4x-UniversityX-
      UX_3_01x-video-02874e0ae0c74ae7b16faa5d6fdc8085",
    "encoded_module_id": "i4x-UX-UT_3_01x-video-
      02874e0ae0c74ae7b16faa5d6fdc8085",
    "duration": 142,
    "segment_length": 5,
    "users_at_start": 2,
    "users_at_end": 0,
    "created": "2015-04-15T214158"
  },
  {
    "pipeline_video_id": "UniversityX/UX.3.01x/1T2015|i4x-UniversityX-
      UX_3_01x-video-03454e0ae0c72ae7b16fab3d6fdc2143",
    "encoded_module_id": "i4x-UX-UT_3_01x-video-
      03454e0ae0c72ae7b16fab3d6fdc2143",
    "duration": 66,
    "segment_length": 5,
    "users_at_start": 1044,
    "users_at_end": 0,
    "created": "2015-04-15T214158"
  },
]