DCAS Open EdX Documentation

DCAS Open EdX Documentation

  • Docs

›API

Creating a Course

  • Create a New Online Course
  • Set Course Schedule & Details
  • Add Sections, Subsections & Units
  • Managing Unit and Component
  • Adding Videos
  • Adding HTML
  • Adding Discussions
  • Adding Problems

    • Adding Problems
    • Problem Types
    • Drag and Drop
    • Pointing on a picture
  • Adding Images and Figures
  • Uploading Static Content
  • Course Visibility
  • Creating pages
  • Grading
  • Commonly Used Advanced Settings

Running a Course

  • Managing Certificates
  • Common Instructor Dashboard Tasks
  • Managing Course Discussions

Advanced Management

  • Importing / Exporting Courses
  • Change a user’s password
  • Inactivate / Activate a User
  • Understanding User Roles
  • Set a user to staff or superuser
  • Server Tasks

    • SSH into Server
    • Set or Change a Password

Migration

  • Migrate EdX (Single-Server)
  • Migrate the Theme

Migrate MySQL

  • Migrating MySQL Database off of Single-Server

Migrate Mongo

  • Migrating Mongo Database off of Single-Server

Configuration

  • Enable and Update Additional Languages
  • Enable Downloads from Instructor tab in LMS
  • Configure and Enable Certificate
  • Configure Open Response Assessment

Configure Ecommerce

  • Basic Ecommerce Setup
  • Setup JWT Keys
  • Getting Course Details on Checkout Page
  • Troubleshoot Ecommerce

Discovery Setup

  • Configure Discovery

Comprehensive theming

  • Setup Comprehensive Theming

Microsites

  • Setup Microsites
  • Common Microsite Configurations

API

  • Setup API
  • Common APIs Demonstration
  • Customizing an API
  • DCAS API Handoff for LMS

Xblock

  • Xblock introduction
  • Xblock installation and uninstallation
  • Xblock Development

Scaling the architecture

  • Scaling Mongo
  • Scaling MySQL
  • Dedicated Storage Configuration Outline
  • Azure Storage Configuration

    • Azure Storage Configuration
    • Basic Configuration
    • Private Blob Configuration

SCORM

  • SCORM Azure Storage

Trouble-Shooting

  • Forgot admin username or password
  • Server error
  • Can't reach your site
  • Problems with RabbitMQ
  • Can't login to LMS or CMS
  • Locate the error
  • Jobs are stucking
  • Mongodb not working
  • Forums Breaking Issue
  • Check open edx services status
  • Problem with mysql
  • Can't receive email
  • CSRF token error

DCAS API Handoff for LMS

Pre-Requisites

Running API Commands relies on:

  • A user in EdX
  • User privileges
  • A Client ID and Client Secret

Firstly, we decide which user we'll use for making API requests and make sure that user exists and is active in Open EdX. This user can either be an actual user (e.g. jsmith@dcas.nyc.gov) or a dummy user (api_admin@example.com). Either is fine, but requests will be tied back to that user and occasionally emails may be sent to that user.

Then we make sure that user has all the privileges they need to do things like enroll/unenroll users from a course. Generally, that means we give them superuser and platform staff access.

Finally, we need a Client ID and Client Secret. These are credentials EdX generates so that our user can make requests from outside the Open EdX system. They should be kept safe.

To generate a Client ID and Client Secret, the user should login to Open EdX and then navigate to [EdX URL]/api-admin and fill out the form to request API Credentials. If the request is approved, the requesting user should navigate back to [Edx URL]/api-admin and fill out a second form.

At this point, the user will be provided their client ID and client Secret. They can always log in and access [EDX URL]/api-admin/status to review these credentials or regenerate them.

General

Request a Bearer Token

About:

A bearer token is required for most API requests. It authenticates the user making the request with the Open EdX LMS.

Request:

curl --location --request POST '[EdX URL]/oauth2/access_token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=[Client ID]' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'token_type=bearer' \
--data-urlencode 'client_secret=[Client Secret]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Client IDThe Client ID Retrieved from 'Pre-Requisites' aboveA 40-character random alphanumeric string
Client SecretThe Client Secret Retrieved from 'Pre-Requisites' aboveA 128-character random alphanumeric string

Note: By default, bearer tokens expire after 10 hours (36000 seconds). Their duration can be extended by an Open EdX admin.

Code changed for DCAS?: No

Sample Output:

API Sample: Request Bearer token

Course Details

Get List of Courses

About:

It returns a list of all the courses present in the LMS. It requires Bearer Token authentication.

Request:

curl --location --request GET '[EdX URL]/api/courses/v1/courses/' \
--header 'Authorization: Bearer [Bearer Token]' \

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters

Code changed for DCAS?: No

Sample Request:

API Sample: Request Course List

Sample Output:

API Sample: Course List Response

Get List of Sections, Subsections, or Units in a Course

About:

It returns a list of all the subsections present inside the course. It requires Bearer Token authentication.

Request:

curl --location --request GET '[EdX URL]/api/courses/v1/blocks/?course_id=[CourseID]&username=[username]&depth=all&block_types_filter=sequential' \
--header 'Authorization: Bearer [Bearer Token]' \

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
CourseIDThe Course ID of which subsections are being requestedcourse-v1:edX+DemoX+Demo_Course
usernameA username making the request. Results will be limited to what that user has access to. If you want to view all results, make sure the requesting user has platform staff accessadmin_user
depthThe number of subsections requestedA numeric value or 'all'
Block Types FilterThe type of hierarchy that is to be requested'chapter' for retrieving all sections
'sequential' for retrieving all sub-sections
'vertical' for retrieving all units

Code changed for DCAS?: No

Sample Request:

API Sample: Course Subsection List

Get information about a course

About:

It returns the general information about a course. It requires Bearer Token authentication.

Request:

curl --location --request GET '[EdX URL]/api/courses/v1/courses/[Course ID]' \
--header 'Authorization: Bearer [Bearer Token]' \
--header 'Cookie: openedx-language-preference=en'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Course IDCourse ID to get the list of enrollmentcourse-v1:edX+DemoX+Demo_Course
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters

Code changed for DCAS?: No

Sample Request:

API Sample: Info about course

Enrollment

Get list of enrollments in a course

About:

It returns a list of all the user enrolled in a course. It requires Bearer Token authentication.

Request:

curl --location --request GET '[EdX URL]/api/enrollment/v1/enrollments?course_id=[Course ID]' \
--header 'Authorization: Bearer [Bearer Token]' \
--header 'Cookie: openedx-language-preference=en'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Course IDCourse ID to get the list of enrollmentcourse-v1:edX+DemoX+Demo_Course
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters

Code changed for DCAS?: No

Sample Request:

API Sample: Course Subsection List

Get Enrollments for a User

About:

It returns a list of all the courses in which the user is enrolled. It requires Bearer Token authentication.

Request:

curl --location --request GET '[EdX URL]/api/enrollment/v1/enrollment' \
--header 'Authorization: Bearer [Bearer Token]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters

Code changed for DCAS?: No

Sample Request:

API Sample: Course Subsection List

Enroll a User

About:

This command enrolls a single user in a course. It requires that the user exists in Open EdX.

Request:

curl --location --request POST '[EdX URL]/api/enrollment/v1/enrollment?=' \
--header 'Authorization: Bearer [Bearer Token]' \
--header 'Content-Type: application/json' \
--data-raw '{"mode":"honor", "user":"[username]", "course_details":{"course_id": "[Course ID]"}}'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenThe token authenticating your user with Open EdXA 30-character random alphanumeric string
usernameThe Open EdX username of the user to enroll in the course.honor
Course IDThe course ID of the course to enroll the user intocourse-v1:edX+DemoX+Demo_Course

Code changed for DCAS?: Yes

Commit Name: Enroll and Unenroll a non-registered user using API [Added bearer authetication]

Sample Output:

API Sample: Enroll a Single User

Pre-enroll a user

About:

It enrolls an un-registered user in a course. It requires Bearer Token authentication.

Request:

curl --location --request POST '[EdX URL]/courses/[CourseID]/instructor/api/students_update_enrollment' \
--header 'Referer: [EdX URL]/courses/[CourseID]/instructor' \
--header 'Authorization: Bearer [Bearer Token]' \
--form 'action="enroll"' \
--form 'identifiers=[email]' \
--form 'role="Learner"' \
--form 'auto_enroll="True"' \
--form 'email_students="True"' \
--form 'instructor=[username]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
CourseIDThe Course ID of which subsections are being requestedcourse-v1:edX+DemoX+Demo_Course
ActionThe action to take against a user'enroll' to enroll the user in the course
'unenrol' to un-enroll a user from the course
IdentifiersThe email of the user to enroll in the courselearner@example.com
RoleThe role to enroll as in the course'Learner' to enroll as a learner in the course
Other options include 'Support' and 'Partner'
Auto EnrollThe type of hierarchy that is to be requested'chapter' for retrieving all sections
'sequential' for retrieving all sub-sections
'vertical' for retrieving all units
Email StudentsWhether to inform the user via email or notEither 'True' or 'False'
InstructorThe username of the instructor who is enrolling the studentadmin_user

Code changed for DCAS?: Yes

Commit Name: Enroll and Unenroll a non-registered user using API [Added bearer authetication]

Sample Request:

API Sample: Course Subsection List

Sample Output:

API Sample: Course Subsection List

Enroll a Staff

About:

It enrolls a staff users in a course. It requires Bearer Token authentication.

Request:

curl --location --request POST '[EdX URL]/courses/[CourseID]/instructor/api/modify_access_mobile' \
--header 'Authorization: Bearer [Bearer Token]' \
--header 'Cookie: openedx-language-preference=en' \
--form 'unique_student_identifier=[username_to_enroll]' \
--form 'rolename="staff"' \
--form 'action="allow"' \
--form 'instructor=[username]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
CourseIDThe Course ID of which subsections are being requestedcourse-v1:edX+DemoX+Demo_Course
ActionThe action to take against a user'allow' to enroll the user in the course as staff
Unique Student IdentifierThe username of the user to enroll in the course as staffstaff
RoleThe role to enroll as in the course'staff' to enroll as a staff in the course.
InstructorThe username of the instructor who is enrolling the studentadmin_user

Code changed for DCAS?: Yes

Commit Name: New Mobile API to enroll/unenroll a staff user

Sample Request:

API Sample: Course Subsection List

Sample Output:

API Sample: Course Subsection List

Bulk Enroll Users

About:

It enrolls a bulk users in a course. It requires Bearer Token authentication.

Request:

curl --location --request POST '[EdX URL]/courses/[CourseID]/instructor/api/students_update_enrollment' \
--header 'Referer: [EdX URL]/courses/[CourseID]/instructor' \
--header 'Authorization: Bearer [Bearer Token]' \
--form 'action="enroll"' \
--form 'identifiers="[email_id_01]
[email_id_02]"' \
--form 'role="Learner"' \
--form 'auto_enroll="True"' \
--form 'email_students="True"' \
--form 'instructor=[username]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
CourseIDThe Course ID of which subsections are being requestedcourse-v1:edX+DemoX+Demo_Course
ActionThe action to take against a user'enroll' to enroll the user in the course
'unenrol' to un-enroll a user from the course
IdentifiersThe email IDs of all the users to enroll in the courselearner@example.com
RoleThe role to enroll as in the course'Learner' to enroll as a learner in the course
Other options include 'Support' and 'Partner'
Auto EnrollThe type of hierarchy that is to be requested'chapter' for retrieving all sections
'sequential' for retrieving all sub-sections
'vertical' for retrieving all units
Email StudentsWhether to inform the user via email or notEither 'True' or 'False'
InstructorThe username of the instructor who is enrolling the studentadmin_user

Code changed for DCAS?: Yes

Commit Name: Enroll and Unenroll a non-registered user using API [Added bearer authetication]

Sample Request:

API Sample: Course Subsection List

Sample Output:

API Sample: Course Subsection List

Unenroll a User

About:

It unenrolls a user in a course. It requires Bearer Token authentication.

Request:

curl --location --request POST '[EdX URL]/courses/[CourseID]/instructor/api/students_update_enrollment' \
--header 'Referer: [EdX URL]/courses/[CourseID]/instructor' \
--header 'Authorization: Bearer [Bearer Token]' \
--form 'action="unenroll"' \
--form 'identifiers=[email]' \
--form 'role="Learner"' \
--form 'auto_enroll="True"' \
--form 'email_students="True"' \
--form 'instructor=[username]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
CourseIDThe Course ID of which subsections are being requestedcourse-v1:edX+DemoX+Demo_Course
ActionThe action to take against a user'enroll' to enroll the user in the course
'unenrol' to un-enroll a user from the course
IdentifiersThe email IDs of all the users to enroll in the courselearner@example.com
RoleThe role to enroll as in the course'Learner' to enroll as a learner in the course
Other options include 'Support' and 'Partner'
Auto EnrollThe type of hierarchy that is to be requested'chapter' for retrieving all sections
'sequential' for retrieving all sub-sections
'vertical' for retrieving all units
Email StudentsWhether to inform the user via email or notEither 'True' or 'False'
InstructorThe username of the instructor who is enrolling the studentadmin_user

Code changed for DCAS?: Yes

Commit Name: Enroll and Unenroll a non-registered user using API [Added bearer authetication]

Sample Request:

API Sample: Course Subsection List

Sample Output:

API Sample: Course Subsection List

Unenroll a pre-enrollment

About:

It un-enrolls an un-registered user in a course. It requires Bearer Token authentication.

Request:

curl --location --request POST '[EdX URL]/courses/[CourseID]/instructor/api/students_update_enrollment' \
--header 'Referer: [EdX URL]/courses/[CourseID]/instructor' \
--header 'Authorization: Bearer [Bearer Token]' \
--form 'action="unenroll"' \
--form 'identifiers=[email]' \
--form 'role="Learner"' \
--form 'email_students="True"' \
--form 'instructor=[username]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
CourseIDThe Course ID of which subsections are being requestedcourse-v1:edX+DemoX+Demo_Course
ActionThe action to take against a user'enroll' to enroll the user in the course
'unenrol' to un-enroll a user from the course
IdentifiersThe email of the user to enroll in the courselearner@example.com
RoleThe role to enroll as in the course'Learner' to enroll as a learner in the course
Other options include 'Support' and 'Partner'
Auto EnrollThe type of hierarchy that is to be requested'chapter' for retrieving all sections
'sequential' for retrieving all sub-sections
'vertical' for retrieving all units
Email StudentsWhether to inform the user via email or notEither 'True' or 'False'
InstructorThe username of the instructor who is enrolling the studentadmin_user

Code changed for DCAS?: Yes

Commit Name: Enroll and Unenroll a non-registered user using API [Added bearer authetication]

Sample Request:

API Sample: Course Subsection List

Sample Output:

API Sample: Course Subsection List

Unenroll a Staff

About:

It unenrolls a staff users in a course. It requires Bearer Token authentication.

Request:

curl --location --request POST '[EdX URL]/courses/[CourseID]/instructor/api/modify_access_mobile' \
--header 'Authorization: Bearer [Bearer Token]' \
--header 'Cookie: openedx-language-preference=en' \
--form 'unique_student_identifier=[username_to_unenroll]' \
--form 'rolename="staff"' \
--form 'action="revoke"' \
--form 'instructor=[username]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
CourseIDThe Course ID of which subsections are being requestedcourse-v1:edX+DemoX+Demo_Course
ActionThe action to take against a user'revoke' to unenroll the user in the course as staff
Unique Student IdentifierThe username of the user to unenroll in the course as staffstaff
RoleThe role to enroll as in the course'staff' to enroll as a staff in the course.
InstructorThe username of the instructor who is enrolling the studentadmin_user

Code changed for DCAS?: Yes

Commit Name: New Mobile API to enroll/unenroll a staff user

Sample Request:

API Sample: Course Subsection List

Sample Output:

API Sample: Course Subsection List

Bulk Unenroll Users

About:

It unenrolls bulk users in a course. It requires Bearer Token authentication.

Request:

curl --location --request POST '[EdX URL]/courses/[CourseID]/instructor/api/students_update_enrollment' \
--header 'Referer: [EdX URL]/courses/[CourseID]/instructor' \
--header 'Authorization: Bearer [Bearer Token]' \
--form 'action="unenroll"' \
--form 'identifiers="[email_id_01]
[email_id_02]"' \
--form 'role="Learner"' \
--form 'auto_enroll="True"' \
--form 'email_students="True"' \
--form 'instructor=[username]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
CourseIDThe Course ID of which subsections are being requestedcourse-v1:edX+DemoX+Demo_Course
ActionThe action to take against a user'enroll' to enroll the user in the course
'unenrol' to un-enroll a user from the course
IdentifiersThe email IDs of all the users to enroll in the courselearner@example.com
RoleThe role to enroll as in the course'Learner' to enroll as a learner in the course
Other options include 'Support' and 'Partner'
Auto EnrollThe type of hierarchy that is to be requested'chapter' for retrieving all sections
'sequential' for retrieving all sub-sections
'vertical' for retrieving all units
Email StudentsWhether to inform the user via email or notEither 'True' or 'False'
InstructorThe username of the instructor who is enrolling the studentadmin_user

Code changed for DCAS?: Yes

Commit Name: Enroll and Unenroll a non-registered user using API [Added bearer authetication]

Sample Request:

API Sample: Course Subsection List

Sample Output:

API Sample: Course Subsection List

Grades

Get Course Grades for all users in a course

About:

It returns a list of all the users enrolled and their grades in the course. It requires Bearer Token authentication.

Request:

curl --location --request GET '[EdX URL]/api/grades/v1/courses/[CourseID]/' \
--header 'Authorization: Bearer [Bearer Token]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
CourseIDThe Course ID of which subsections are being requestedcourse-v1:edX+DemoX+Demo_Course

Code changed for DCAS?: No

Sample Output:

API Sample: Course Subsection List

Get Course Grade for a single user

About:

It returns the grades for the user in the particular course. It requires Bearer Token authentication.

Request:

curl --location --request GET '[EdX URL]/api/grades/v1/courses/[CourseID]/?username=[username]' \
--header 'Authorization: Bearer [Bearer Token]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
CourseIDThe Course ID of which subsections are being requestedcourse-v1:edX+DemoX+Demo_Course
usernameThe username of the learner user whose grades are requestedlearner_user

Code changed for DCAS?: No

Sample Output:

API Sample: Course Subsection List

Get Section Grade

About:

It returns the grades for the user in the particular section of the course. It requires Bearer Token authentication.

Request:

curl --location --request GET '[EdX URL]/api/grades/v1/subsection/[BlockID]?user_id=[UserID]' \
--header 'Authorization: Bearer [Bearer Token]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
BlockIDThe Block ID of which grades are being requestedblock-v1:edX+DemoX+Demo_Course+type@sequential+block@edx_introduction
UserIDThe User ID of the learner user whose grades are requested10

Code changed for DCAS?: No

Sample Output:

API Sample: Course Subsection List

Get User Gradebook

About:

It returns the list of gradebooks for the users enrolled in the particular course. It requires Bearer Token authentication.

Request:

curl --location --request GET '[EdX URL]/api/grades/v1/gradebook/[CourseID]/' \
--header 'Authorization: Bearer [Bearer Token]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
CourseIDThe Course ID of which subsections are being requestedcourse-v1:edX+DemoX+Demo_Course

Code changed for DCAS?: No

Sample Output:

API Sample: Course Subsection List

User

Get User's Public Information

About:

It returns the all the public information for a particular user. It requires Bearer Token authentication.

Request:

curl --location --request GET '[EdX URL]/api/user/v1/accounts?email=[email]' \
--header 'Authorization: Bearer [Bearer Token]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
EmailThe email of the user of whose information is requestedtest@example.com

Code changed for DCAS?: No

Sample Output:

API Sample: Course Subsection List

Update a User's Information

About:

It updates the information of the User whose username is passed in the URL and returns all the public information for a that user. It requires Bearer Token authentication. You can change the values of the following through this API:

  • account_privacy
  • profile_image
  • username
  • bio
  • course_certificates
  • country
  • date_joined
  • language_proficiencies
  • level_of_education
  • social_links
  • time_zone
  • accomplishments_shared
  • name
  • email
  • extended_profile
  • gender
  • state
  • goals
  • is_active
  • mailing_address
  • requires_parental_consent
  • secondary_email
  • secondary_email_enabled
  • year_of_birth
  • phone_number
  • guid
  • first_name
  • last_name.

Request:

curl --location --request PATCH '[EdX URL]/api/user_extra_info/v1/update/[username]/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer [Bearer Token]' \
--data-raw '{
    "guid":[new_guid]
}'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
usernameThe username of the user whose email is to be changedcourse-v1:edX+DemoX+Demo_Course
GUIDThe new GUID of the user that is to be savedA random alphanumeric string of 30-characters

Code changed for DCAS?: Yes

Commit Name: Modified User Information Update API to update and return first_name and last_name

Sample Output:

API Sample: Update User's Information

Provision a new user

About:

This command creates a new user.

Request:

curl --location --request POST '[EdX URL]/user_api/v1/account/registration/?=' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=[username]' \
--data-urlencode 'name=[name]' \
--data-urlencode 'email=[email]' \
--data-urlencode 'password=[password]' \
--data-urlencode 'terms_of_service=true' \
--data-urlencode 'honor_code=true' \
--data-urlencode 'country=[country_code]' \
--data-urlencode 'training_id=[training_id]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
UsernameThe username of the new usernew_user
NameThe name of the new userNew User
EmailThe email of the new usertest@example.com
PasswordThe password of the new usertest123
Country CodeThe country code of the new userUS
Training IDThe training of the new user1

Code changed for DCAS?: No

Sample Output:

API Sample: Provision a New User

Create the SSO link of new user

About:

This command creates a the SSO link of the user with NYCID.

Request:

curl --location --request POST '[EdX URL]/api/dcas_social_auth/[username]/[guid]/' \
--header 'Authorization: Bearer [Bearer Token]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
UsernameThe username of the new usernew_user
GUIDThe GUID of the new userA random alphanumeric string of 30-characters
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters

Code changed for DCAS?: Yes

Commit Name: Created new app dcas_social_login for the API to create SSO link entry in the usersocialauth table

Sample Output:

API Sample: Create the SSO link of New User

Login a User

Deactivate a user

About:

It removes the password of the User whose username is passed in the URL so that User can not log-in/register again. It requires Bearer Token.

Request:

curl --location --request POST '[EdX URL]/api/user/v1/accounts/[username]/deactivate/' \
--header 'Authorization: Bearer [Bearer Token]'

Parameters:

ParameterDescriptionExample
EdX URLURL of the EdX Instancehttps://azudcs-edxltw04.dcas.nycnet
Bearer TokenIt is used to authenticate the userA random alphanumeric string of 30-characters
UsernameThe username of the user to be deactivateduser_name

Code changed for DCAS?: Yes

Commit Name: Add bearer token in Retirement API

Sample Output:

API Sample: Course Subsection List

Course Export

Export a Course via API

[To Be built]

← Customizing an APIXblock introduction →
  • Pre-Requisites
  • General
    • Request a Bearer Token
  • Course Details
    • Get List of Courses
    • Get List of Sections, Subsections, or Units in a Course
    • Get information about a course
  • Enrollment
    • Get list of enrollments in a course
    • Get Enrollments for a User
    • Enroll a User
    • Pre-enroll a user
    • Enroll a Staff
    • Bulk Enroll Users
    • Unenroll a User
    • Unenroll a pre-enrollment
    • Unenroll a Staff
    • Bulk Unenroll Users
  • Grades
    • Get Course Grades for all users in a course
    • Get Course Grade for a single user
    • Get Section Grade
    • Get User Gradebook
  • User
    • Get User's Public Information
    • Update a User's Information
    • Provision a new user
    • Create the SSO link of new user
    • Login a User
    • Deactivate a user
  • Course Export
    • Export a Course via API
DCAS Open EdX Documentation
Docs
Create an Online Course
More
Curricu.me Website
Copyright © 2022 DCAS