API: enrollLearningModules
  • 6 Minutes to read
  • Dark
    Light

API: enrollLearningModules

  • Dark
    Light

Article summary

  • Starting June 1, 2022, SmarterU will require all API calls to POST to HTTPS. Any POST to HTTP will result in the SU:01 error (i.e., No POST data detected.).
  • If you are viewing the help in a language other than English, please change your language to English before copying and pasting any code. All API attributes and functions are in English.
  • Tags are required unless specified.

Description

The enrollLearningModules method enrolls users in courses. 

Who Has Access

The following users have access to the enrollLearningModules method:

API Call XML Package

<SmarterU>
   <AccountAPI><![CDATA[]]></AccountAPI>
   <UserAPI><![CDATA[]]></UserAPI>
   <Method>enrollLearningModules</Method>
   <Parameters>
      <LearningModuleEnrollment>
         <Enrollment>
            <User>
               <Email><![CDATA[]]></Email>
                  - OR -
               <EmployeeID><![CDATA[]]></EmployeeID>
            </User>
 
            <GroupName><![CDATA[]]></GroupName>
            <LearningModuleID><![CDATA[]]></LearningModuleID>
            <LearningModuleSessionID><![CDATA[]]></LearningModuleSessionID>
            <EnrollmentTag><![CDATA[]]></EnrollmentTag>

            <DueDateSettings>
               <SettingSource><![CDATA[]]></SettingSource>
               <DueDateSetup>
                  <DueDate><![CDATA[]]></DueDate>
                     - OR -
                  <DueDateDays><![CDATA[]]></DueDateDays>
               </DueDateSetup>
               <AccessSetup>
                  <AccessEndDate><![CDATA[]]></AccessEndDate>
                     - OR -
                  <AccessEndDays><![CDATA[]]></AccessEndDays>
               </AccessSetup>
               <CompletionAccessDays><![CDATA[]]></CompletionAccessDays>
            </DueDateSettings>
         </Enrollment>
      </LearningModuleEnrollment>
   </Parameters>
</SmarterU>    

LearningModuleEnrollment Tag Group

The LearningModuleEnrollment tag group is a container for the course enrollments. 

<LearningModuleEnrollment>
   <Enrollment>
      <User>
         <Email><![CDATA[]]></Email>
            - OR -
         <EmployeeID><![CDATA[]]></EmployeeID>
      </User>

      <GroupName><![CDATA[]]></GroupName>
      <LearningModuleID><![CDATA[]]></LearningModuleID>
      <LearningModuleSessionID><![CDATA[]]></LearningModuleSessionID>
      <EnrollmentTag><![CDATA[]]></EnrollmentTag>

      <DueDateSettings>
         <SettingSource><![CDATA[]]></SettingSource>
         <DueDateSetup>
            <DueDate><![CDATA[]]></DueDate>
               - OR - 
            <DueDateDays><![CDATA[]]></DueDateDays>
         </DueDateSetup>
      
         <AccessSetup>
            <AccessEndDate><![CDATA[]]></AccessEndDate>
               - OR -
            <AccessEndDays><![CDATA[]]></AccessEndDays>
         </AccessSetup>
         <CompletionAccessDays><![CDATA[]]></CompletionAccessDays>
      </DueDateSettings>
   </Enrollment>
</LearningModuleEnrollment>

The LearningModuleEnrollment tag may contain the following.

Enrollment

A container for the course enrollment. Refer to Enrollment Tag Group

Enrollment Tag Group

The Enrollment tag group is a container for a course enrollment.

<Enrollment>
   <User>
      <Email><![CDATA[]]></Email>
         - OR -
      <EmployeeID><![CDATA[]]></EmployeeID>
   </User>
 
   <GroupName><![CDATA[]]></GroupName>
   <LearningModuleID><![CDATA[]]></LearningModuleID>
   <LearningModuleSessionID><![CDATA[]]></LearningModuleSessionID>
   <EnrollmentTag><![CDATA[]]></EnrollmentTag>

   <DueDateSettings>
      <SettingSource><![CDATA[]]></SettingSource>
      <DueDateSetup>
         <DueDate><![CDATA[]]></DueDate>
            - OR -
         <DueDateDays><![CDATA[]]></DueDateDays>
      </DueDateSetup>
      <AccessSetup>
         <AccessEndDate><![CDATA[]]></AccessEndDate>
            - OR -
         <AccessEndDays><![CDATA[]]></AccessEndDays>
      </AccessSetup>
      <CompletionAccessDays><![CDATA[]]></CompletionAccessDays>
   </DueDateSettings>
</Enrollment>

Each course enrollment is contained in an Enrollment tag and may contain the following. 

The enrollLearningModules method supports up to 100 enrollments per call.

User

The user to enroll in a course. The User tag contains one of the following.

TagDescription

Email

The user's email address. This tag is mutually exclusive with the EmployeeID tag. This is the Email returned by the getUser and listUsers methods.

EmployeeID

The user's employee ID. This tag is mutually exclusive with the Email tag. This is the EmployeeID returned by the getUser and listUsers methods. 

GroupName

The enrollment group's name.

The user you are trying to enroll in a course must already be assigned to this group.

LearningModuleID

The course's system-generated identifier. This is the LearningModuleID returned by the listLearningModules method. 

LearningModuleSessionID (conditionally required)

This tag is only required when the LearningModuleID provided is an instructor-led course. 

The session's system-generated identifier. This is the CourseSessionID returned by the listSessions method.

EnrollmentTag (optional)

The tag that the enrollment will be grouped under. 

DueDateSettings (optional)

A container for the enrollment's due date, grace period, and completion access. Refer to DueDateSettings Tag Group

DueDateSettings Tag Group (optional)

The DueDateSettings tag group is a container for the enrollment's due date, grace period, and completion access

<DueDateSettings>
   <SettingSource><![CDATA[]]></SettingSource>
      <DueDateSetup>
         <DueDate><![CDATA[]]></DueDate>
            - OR -
         <DueDateDays><![CDATA[]]></DueDateDays>
      </DueDateSetup>
      <AccessSetup>
         <AccessEndDate><![CDATA[]]></AccessEndDate>
            - OR -
         <AccessEndDays><![CDATA[]]></AccessEndDays>
      </AccessSetup>
   <CompletionAccessDays><![CDATA[]]></CompletionAccessDays>
</DueDateSettings>
  • The DueDateSettings tag group can only be used with online and SCORM courses. 
  • If the DueDateSettings tag group is not provided, the course's due date and completion access settings will be used. 

The DueDateSettings tag may contain the following.

SettingSource (optional)

Indicates whether to override the course's due date and completion access settings. Acceptable values are:

  • Course - Use the course's due date and completion access settings.
  • Override - Specify different settings than the course's due date and completion access settings.

DueDateSetup (optional)

This tag is only required when SettingSource is set to Override

The course's due date. The DueDateSetup tag contains one of the following.

TagDescription
DueDateThe date the course must be completed by. Acceptable values are:
  • A date in MM/DD/YYYY format.
  • NoLimit - The course enrollment has no due date.

This tag is mutually exclusive with the DueDateDays tag. 

DueDateDaysThe number of days from the time of enrollment that the course will be due. This must be a numerical value greater than 0. This tag is mutually exclusive with the DueDate tag.

AccessSetup (optional) 

This tag is only required when SettingSource is set to Override.

The course enrollment's grace period. The AccessSetup tag contains one of the following.

TagDescription
AccessEndDateThe last date that the user will be able to access the course after its due date. Acceptable values are:
  • A date in MM/DD/YYYY format.
  • NoLimit - The user can access the course indefinitely after the due date.

This tag is mutually exclusive with the AccessEndDays tag.

AccessEndDaysThe number of days after the due date that a user will be able to access the course. This must be a numerical value greater than 0. This tag is mutually exclusive with the AccessEndDate tag.

CompletionAccessDays (optional)

This tag is only required when SettingSource is set to Override

The number of days that the user will be able to access the course after they complete it. Setting this to 0 will make review unavailable. 

API Response XML Package

The API response XML package will always include a Result, Info, and Errors tag.

<SmarterU>
   <Result>![CDATA[]]</Result>

   <Info>
      <Enrollments>
         <Enrollment>
            <User><![CDATA[]]></User>
            <LearningModuleID>![CDATA[]]</LearningModuleID>
            <AccountUserLearningModuleRelID>![CDATA[]]</AccountUserLearningModuleRelID>
         </Enrollment>
      </Enrollments>
   </Info>

   <Errors>
      <Error>
         <ErrorID></ErrorID>
         <ErrorMessage></ErrorMessage>
      </Error>
   </Errors>

</SmarterU>

The Enrollments tag is a container for the course enrollments processed by the enrollLearningModules method. Each course enrollment is contained in an Enrollment tag and may contain the following. 

User

The user's identifier. This returns the same value that was provided in the Enrollment tag group

LearningModuleID

The course's system-generated identifier. This returns the same value that was provided in the Enrollment Tag group .

AccountUserLearningModuleRelID

The system-generated identifier for the user's course enrollment.

Because this method can be used to perform multiple enrollments, be sure to check the Errors tag for error codes. It's possible for the Result tag to return Success even when errors are returned.

Example API Response XML Package

Below is an example of an API response XML package.

<SmarterU>
   <Result>Success</Result>

   <Info>
      <Enrollments>
         <Enrollment block="1">
            <User><![CDATA[dana.brown@finashoes.com]]></User>
            <LearningModuleID>122585</LearningModuleID>
            <AccountUserLearningModuleRelID>17335503</AccountUserLearningModuleRelID>
         </Enrollment>
    
         <Enrollment block="3">
            <User><![CDATA[marie.vasquez@finashoes.com]]></User>
            <LearningModuleID>122585</LearningModuleID>
            <AccountUserLearningModuleRelID>17335585</AccountUserLearningModuleRelID>
         </Enrollment>
      </Enrollments>
   </Info>

   <Errors>
      <Error block="2">
         <ErrorID>ELM:08</ErrorID>
         <ErrorMessage>Enrollment 2 - The email address 'hal.horner@finashoes.com' is not a valid user.</ErrorMessage>
      </Error>
   </Errors>

</SmarterU>

Error Codes

Error CodeMessage
ELM:01
The e-mail address provided is not valid.
ELM:02
The employee ID provided is not valid.
ELM:03
The group name provided is not valid.
ELM:04
The learning module ID provided is not valid.
ELM:05
The learning module session ID provided is not valid.
ELM:06
The skill profile ID provided is not valid.
ELM:07
The assignment tag provided is not valid.
ELM:08
Enrollment %blocknum% - The email address '%emailaddress%' is not a valid user.
ELM:09
Enrollment %blocknum% - The employee id '%employeeid%' is not a valid user.
ELM:10
Enrollment %blocknum% - No user identifier was provided.
ELM:11
Enrollment %blocknum% - The learning module ID provided is not valid.
ELM:12
Enrollment %blocknum% - The group name '%groupname%' is not valid.
ELM:13
Enrollment %blocknum% - You cannot assign the learning module under the group selected.
ELM:14
Enrollment %blocknum% - You do not have permissions to assign a user a course under the group selected.
ELM:15
Enrollment %blocknum% - The external course session provided is not valid.
ELM:16
Enrollment %blocknum%- External course session was not provided.
ELM:17
Enrollment %blocknum% - The learning module requires that a skill profile is provided.
ELM:18
Enrollment %blocknum% - The skill profile provided is not valid.
ELM:19
Enrollment %blocknum% - %enrollmenterror%
This is a dynamic error in the enrollment process. This is caused when the enrollment information provided was valid but the user could not be enrolled in the course due to one of the following reasons:
  • User is already enrolled in the learning module
  • ILT session is full and waiting list is disabled
  • ILT session is full and the user is added to the waiting list
  • ILT session is full and the user is already on the waiting list
ELM:20
The required permissions are not met to call the enrollLearningModules method.
ELM:21
The setting source provided is not valid.
ELM:22
The value for the amount of days that a course is due must be a numeric value.
ELM:23
The value for the amount of days that a course is accessible after completion must be a numeric value.
ELM:24
The course due date provided is not valid.
ELM:25
The course access date provided is not valid.
ELM:26
You must provide either the number of days from course assignment or the date the course is due.
ELM:27
You must provide either the number of days that a course is accessible after completion or the date.
ELM:28
Enrollment %blocknum% - External courses cannot use due date or access overrides.
ELM:29
Enrollment %blocknum% - Only 'Course' or 'Override' are valid values for setting Due Dates for this enrollment.
ELM:30
Enrollment %blocknum% - Due Date and Access values cannot be provided when 'Course' has been selected.
ELM:31
Enrollment %blocknum% - Due Date and Access values must be provided when 'Override' has been selected.
ELM:32
Enrollment %blocknum% - Due dates must be a valid date or set to 'NoLimit'.
ELM:33
Enrollment %blocknum% - Due date days must be greater than zero.
ELM:34
Enrollment %blocknum% - Access end dates must be a valid date or set to 'NoLimit'.
ELM:35
Enrollment %blocknum% - Access end days must be greater than zero.
ELM:36
Enrollment %blocknum% - Due date must be later than the enrollment date.
ELM:37
Enrollment %blocknum% - Access end date must be later than the due date.
ELM:38
Enrollment %blocknum% - Completion Access end days must be greater than or equal to zero.

Was this article helpful?