Enrollments API

List


Resource: /api/v2/enrollments

HTTPS Request Method: GET

Description: Get the list of all enrollments that match the specified parameters. If no optional parameters are specified, the full list of enrollments associated with the account is returned.

Enrollment list results are limited to 1,000 records and must be paginated.


Required Parameters:

  • api_key
  • page - (integer). The page number you want to request. Every page is 1,000 records long at most, and results are returned in id order. Page 1 is assumed if no page number is supplied, but unpaginated requests are subject to API rate limitations.


Optional Parameters:

  • enrollment[id] - (integer)
  • enrollment[code] - (string)
  • enrollment[expires_on] - (datetime)
  • enrollment[enrolled_on] - (datetime)
  • enrollment[due_on] - (date)
  • enrollment[completed_on] - (datetime)
  • enrollment[user_id] - (integer)
  • enrollment[course_id] - (integer)
  • enrollment[course_session_id] - (integer)
  • enrollment[status] - (string)
  • enrollment[started_on] - (datetime)
  • enrollment[updated_on] - (datetime)
  • enrollment[accepted_invite] - (boolean)
  • course[code] - (string)
  • ... (see all the optional attributes of the Courses API List endpoint)
  • session[code] - (string)
  • ... (see all the optional attributes of the Sessions API List endpoint)
  • user[code] - (string)
  • ... (see all the optional attributes of the Users API List endpoint)
  • with_metadata - (string). When "1" each returned enrollment includes a "metadata" entry listing the record metadata attributes
  • enrollment[relationship_type]

 

Dates and datetimes should be in YYYY-MM-DD or YYYY-MM-DD HH:MM:SS format and can be given as ranges if separated by a comma.


Example Request:

curl -X GET -d '{"api_key": "123456", "enrollment": {"status": "in-progress"}, "session": {"started_on": "2010-04-19 00:00:00,2015-04-19 23:59:59"}, "course": {"code": "abc123"}}' -H "Content-type: application/json" -H "Accept: application/json" https://YOURSUBDOMAIN.exceedlms.com/api/v2/enrollments



Example Response:

[
{
"accepted_invite": false,
"account_id": 2,
"attachments_count": null,
"auto_enrollment_id": null,
"code": null,
"completed_activities_count": null,
"completed_on": null,
"course": {"hide_until": 5},
"course_id": 107,
"course_session_id": 15,
"created_by": "demo demo",
"due_on": null,
"enrolled_on": "2015-03-17T18:28:00-05:00",
"expires_on": null,
"graded_by_instructor_id": null,
"id": 1055,
"is_initial_enrollment": false,
"pre_assessment_score": null,
"pre_assessment_status": null,
"progress": 0.0,
"relationship_type": "recommended",
"reminder_count": 0,
"score": null,
"started_on": "2010-04-19T18:28:13-05:00",
"status": "in-progress",
"time": 0,
"updated_by": "demo demo",
"updated_on": "2015-03-17T18:28:38-05:00",
"user_code": "zinzin",
"user_id": 2
}


Create

Resource: /api/v2/enrollments

HTTPS Request Method: POST

Description: Create an enrollment based on the associated params. If the enrollment is unable to be created (for instance if the course or user referred to by the enrollment doesn't exist), a HTTP 422 Unprocessable Entity response is returned. The HTTP response body will contain a list of error reasons in JSON or XML format.  For more information concerning types of values accepted, see https://<your LMS website>/enrollments/import.

Example Request:

curl -X POST -d '{"api_key": "123456", "enrollment": {"course_id": 8, "user_id": 3}}' -H "Content-type: application/json" -H "Accept: application/json" http://YOURSUBDOMAIN.exceedlms.com/api/v2/enrollments


Required Parameters:

  • api_key
  • enrollment[course_id] or enrollment[course_code]
  • enrollment[user_id] or enrollment[user_code]


Optional Parameters:

  • enrollment[course_session_id] - must be the id of an existing session
  • enrollment[course_session_code] - must be the code of an existing session. If this parameter is set, enrollment[course_session_id] is ignored.
  • enrollment[completed_on]
  • enrollment[due_on]
  • enrollment[enrolled_on]
  • enrollment[expires_on]
  • enrollment[progress]
  • enrollment[reminder_count]
  • enrollment[score]
  • enrollment[started_on]
  • enrollment[status]
  • enrollment[time]
  • enrollment[created_by]
  • enrollment[relationship_type]
  • enrollment[metadata_attributes][relationship_reason]


Example Response:

<?xml version="1.0" encoding="UTF-8"?>
<enrollment>
<account-id type="integer">2</account-id>
<attachments-count type="integer" nil="true"></attachments-count>
<auto-enrollment-id type="integer" nil="true"></auto-enrollment-id>
<code nil="true"></code>
<completed-activities-count type="integer" nil="true"></completed-activities-count>
<completed-on type="datetime" nil="true"></completed-on>
<course type="CourseAicc">
<hide-until type="integer">5</hide-until>
</course>
<course-id type="integer">220</course-id>
<course-session-id type="integer" nil="true"></course-session-id>
<due-on type="datetime" nil="true"></due-on>
<enrolled-on type="datetime" nil="true"></enrolled-on>
<expires-on type="datetime" nil="true"></expires-on>
<id type="integer">4833854</id>
<is-initial-enrollment type="boolean">false</is-initial-enrollment>
<progress type="float">0.0</progress>
<relationship-type>recommended</relationship_type>
<reminder-count type="integer">0</reminder-count>
<score type="integer" nil="true"></score>
<started-on type="datetime" nil="true"></started-on>
<status>in-progress</status>
<time type="integer">0</time>
<updated-by type="integer" nil="true"></updated-by>
<updated-on type="datetime">2011-09-15T15:23:00Z</updated-on>
<user-id type="integer">413340</user-id>
</enrollment>

 

Read

Resource: /api/v2/enrollments/{id}

HTTPS Request Method: GET

Description: Lookup an enrollment based on the id.


Example Request:

curl -X GET -H "Content-type: application/json" -H "Accept: application/json" https://YOURSUBDOMAIN.exceedlms.com/api/v2/enrollments/322?api_key=123456


Required Parameters:

  • api_key

Optional Parameters:

  • enrollment[code] - lookup the enrollment using the code. When this param is used the id parameter is ignored.
  • with_metadata - (string). When "1" each returned enrollment includes a "metadata" entry listing the record metadata attributes

Example Response:

<?xml version="1.0" encoding="UTF-8"?>
<enrollment>
<account-id type="integer">2</account-id>
<auto-enrollment-id type="integer" nil="true"></auto-enrollment-id>
<code nil="true"></code>
<completed-on type="datetime">2008-06-23T07:24:22Z</completed-on>
<course type="CourseAicc">
  <hide-until type="integer">5</hide-until>
</course>
<course-id type="integer">20</course-id>
<course-session-id type="integer" nil="true"></course-session-id>
<due-on type="datetime" nil="true"></due-on>
<enrolled-on type="datetime">2008-05-22T08:22:16Z</enrolled-on>
<expires-on type="datetime" nil="true"></expires-on>
<id type="integer">21</id>
<progress type="float">0.0</progress>
<relationship-type>recommended</relationship_type>
<reminder-count type="integer">0</reminder-count>
<score type="integer">100</score>
<started-on type="datetime" nil="true"></started-on>
<status>passed</status>
<time type="integer">34</time>
<updated-by type="integer" nil="true"></updated-by>
<updated-on type="datetime">2008-06-23T03:24:22Z</updated-on>
<user-id type="integer">1</user-id>
</enrollment>



Update

Resource: /api/v2/enrollments/{id}

HTTPS Request Method: PUT

Description: Update an enrollment based on the enrollment id.

Example Request:

curl -i -X PUT -d '{"enrollment": {"score": 60}}' -H "Content-type: application/json" -H "Accept: application/json" https://YOURSUBDOMAIN.exceedlms.com/api/v2/enrollments/12?api_key=123456


Required Parameters:

  • api_key


Optional Parameters:

  • enrollment[code] - the enrollment code can not be updated. When this parameter is passed the LMS looks up the enrollment using the code, and ignores the id parameter.
  • enrollment[course_id]
  • enrollment[course_code] - when this parameter is set, this will update the enrollment[course_id] value with the id of the course having the code enrollment[course_code].
  • enrollment[user_id]
  • enrollment[user_code] - when this parameter is set, this will update the enrollment[user_id] value with the id of the user having the code enrollment[user_code].
  • enrollment[course_session_id]
  • enrollment[course_session_code] - when this parameter is set, this will update the enrollment[course_session_id] value with the id of the session having the code enrollment[course_session_code].
  • enrollment[completed_on]
  • enrollment[due_on]
  • enrollment[enrolled_on]
  • enrollment[expires_on]
  • enrollment[progress]
  • enrollment[reminder_count]
  • enrollment[score]
  • enrollment[started_on]
  • enrollment[status]
  • enrollment[time]
  • enrollment[created_by]
  • enrollment[relationship_type]
  • enrollment[metadata_attributes][relationship_reason]

 

Response:

  • On successful update returns a 200 HTTP response code with an empty body

 

Delete

Resource: /api/v2/enrollments/{id}

Http Request Method: DELETE

Description: Delete an enrollment based on the enrollment id.

Example Request:

curl -i -X DELETE -H "Content-type: application/json" -H "Accept: application/json" https://YOURSUBDOMAIN.exceedlms.com/api/v2/enrollments/12?api_key=123456


Required Parameters:

  • api_key

Optional Parameters:

  • enrollment[code] - when this parameter is passed the LMS looks up the enrollment using the code, and ignores the id parameter


Response:

  • On successful deletion returns a 200 HTTP response code with an empty body

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.