Enrollments

API endpoints for getting or creating enrollments

Get all enrollments

List all enrollments

GET https://your-platform-url.com/api/so2/v1/enrollments

Get all course enrollments for your instance

Headers

NameTypeDescription

Access-Control-Request-Headers*

string

authorization

Authorization*

string

Bearer <auth_token>

Content-Type*

string

application/json

{"username":"johndoe",
"email":"john@example.com",
"course_id":"course-v1:MOOCit-demo-1",
"is_active":true,
"mode":"audit",
"created":"2021-03-09 20:15"
}, 
{"username":"JaneDoe",
"email":"jane@example.com",
"course_id":"course-v1:MOOCit-demo-2",
"is_active":true,
"mode":"audit",
"created":"2022-03-09 14:52"
}
...

Get enrollments by course

List enrollments by course

GET https://your-platform-url.com/api/so2/v1/enrollments?course_id={course_id}

Get course enrollments for a given course

Query Parameters

NameTypeDescription

course_id

string

the course_id course-v1:org+num+session

Headers

NameTypeDescription

Access-Control-Request-Headers*

string

authorization

Authorization*

string

Bearer <auth_token>

Content-Type*

string

application/json

{"username":"johndoe",
"email":"john@example.com",
"course_id":"course-v1:MOOCit-demo-1",
"is_active":true,
"mode":"audit",
"created":"2021-03-09 20:15"
}, 
{"username":"JaneDoe",
"email":"jane@example.com",
"course_id":"course-v1:MOOCit-demo-1",
"is_active":true,
"mode":"audit",
"created":"2022-03-09 14:52"
}
...

Get enrollments by username

List enrollments by username

GET https://your-platform-url.com/api/so2/v1/enrollments?username={username}

Get course enrollments for a given username

Query Parameters

NameTypeDescription

username

string

Headers

NameTypeDescription

Access-Control-Request-Headers*

string

authorization

Authorization*

string

Bearer <auth_token>

Content-Type*

string

application/json

{"username": "johndoe",
"email":"john@example.com",
"course_id":"course-v1:MOOCit-demo-1",
"is_active":true,
"mode":"audit",
"created":"2021-03-09 20:15"
}, 
{"username": "johndoe",
"email":"john@example.com",
"course_id":"course-v1:MOOCit-demo-2",
"is_active":true,
"mode":"audit",
"created":"2022-03-09 14:52"
}
...

Get enrollments by days

List enrollments by period

GET https://your-platform-url.com/api/so2/v1/enrollments?days={days}

Get course enrollments for the last past days

Query Parameters

NameTypeDescription

days

integer

Headers

NameTypeDescription

Access-Control-Request-Headers*

string

authorization

Authorization*

string

Bearer <auth_token>

Content-Type*

string

application/json

{"username": "johndoe",
"email":"john@example.com",
"course_id":"course-v1:MOOCit-demo-1",
"is_active":true,
"mode":"audit",
"created":"2021-03-09 20:15"
}, 
{"username": "johndoe",
"email":"john@example.com",
"course_id":"course-v1:MOOCit-demo-2",
"is_active":true,
"mode":"audit",
"created":"2022-03-09 14:52"
}
...

Bulk enroll or unenroll users

Bulk enroll

POST https://your-platform-url.com/api/bulk_enroll/v1/bulk_enroll/

This endpoint allows you enroll or unenroll users to one or several courses. Permissions needed : Be a course admin for the courses you want to enroll users to.

Headers

NameTypeDescription

Access-Control-Request-Headers

string

Authorization

string

Bearer <auth_token>

Content-Type

string

application/json

Request Body

NameTypeDescription

auto_enroll*

Boolean

true

email_students*

Boolean

true or false, set if you want to send email to notify users for enrollments

action*

String

enroll or unenroll

courses*

String

course_id separated with comma

cohorts*

String

cohorts name separated with comma

identifiers*

String

user email separated with comma

{
    "action": "enroll",
    "courses": {
        "course-v1:edX+DemoX+Demo_Course": {
            "action": "enroll",
            "results": [
                {
                    "identifier": "test-email@example.com",
                    "after": {
                        "enrollment": false,
                        "allowed": false,
                        "user": true,
                        "auto_enroll": true
                    },
                    "before": {
                        "enrollment": true,
                        "allowed": false,
                        "user": true,
                        "auto_enroll": true
                    }
                }
            ],
            "auto_enroll": true
        }
    },
    "email_students": true,
    "auto_enroll": true
}

Dernière mise à jour