Get Course Enrollments Report
This API can be used to get course enrollments report (Course session members listing). The API is a restrictive one and can be called by an admin of the site only. Any other user trying to invoke this API would result in an error being returned by the API.
API Details
Signature of API call
connection.invokeApi(String uri, String realUserName, Map<String, String> requestParameters);
See details about invoking API in general
Parameter 1 - URI
reportService.do
Parameter 2 - UserName
Username of any site administrator
Parameter 3 - Request Parameters
Name | Value |
dispatch | listCourseSessionMembers |
No other parameters are required | |
userId | return data for a specific user corresponding to specified userId |
openId | return data for a specific user corresponding to specified openId |
courseId | for a specific course id |
courseSessionId | for a specific course session id |
courseSessionIds | for multiple comma separated course session ids. (If single id is specified using courseSessionId, then this parameter is ignored) |
extId | external id of course session |
extIds | for multiple comma separated external ids. (If single id is specified using extId, then this parameter is ignored) |
groupId | Group Id of the group for which to fetch the learners data |
awarded | empty, true or false, indicates user's completion status in course session |
started | empty, true or false, indicates user's activity status in course session |
userNameSearch | matching username, first/last name, email |
customPropertyMap['property1Name'], customPropertyMap['property2Name'], customPropertyMap['property3Name'] ... ... |
Custom property values to be used for searching "Course Sessions". Only searching for enrollment in filtered list of course sessions. Each property name should be passed as "customPropertyMap['name of property']" These custom properties must be first defined in microsite, using the Site Admin->Custom Properties->Course Session's properties. |
fromDate | min enrolled/start date of learner in course session |
toDate | max enrolled/start date of learner in course session |
awardFromDate | min award date (completion date) of learner in course session |
awardToDate | max award date (completion date) of learner in course session |
Paging parameters | |
currPage | page number to fetch, must be specified for 2nd page onwards. Value of currPage starts with 0. So for page 2 specify currPage = 1 |
numItems | total records in the list, must be specified for 2nd page onwards. You can get the count of records from response of first page. then pass it as-is in subsequent pages. |
pageSize | Number of items in a page |
All date parameters are numbers, represented as epoch time in milliseconds - number of milliseconds that have elapsed since January 1, 1970 (midnight UTC/GMT),
Date filtering note - by default, date filters are converted to BOD and EOD (e.g. from date is converted to beginning of the day and to date is converted to end of day while applying the filtering criteria (similar to report screens in application). If you like to perform exact filtering on the passed date time, then set API_REPORT_USE_EXACT_TIME=true in Site Admin->Site Details->Customization.
Response
1. Response on successfully getting results
HTTP Response Code = HttpServletResponse.SC_OK
Response XML
<response code="0">
<msgs>
<msg>
<code>0</code>
<value><![CDATA[Success]></value>
</msg>
</msgs>
<data>
<courseSessionMembers numItems="485" currPage="2" pageSize="10">
<courseSessionMember id="2fe1ddf0-8de6-11e6-a9c3-7b8f5d23978d" agreementAccepted="false" courseSessionId="d43e237e-6323-11e6-a6aa-51e7922605a9" late="false">
<userId>2fce8ff2-8de6-11e6-a9c3-7b8f5d23978d</userId>
<openId>xxxx:1234</openId>
<firstName><![CDATA[John]]></firstName>
<lastName><![CDATA[Doe>>]</lastName>
<userName><![CDATA[y4il*jdoe]]></userName>
<role>STUDENT</role>
<status>ACTIVE</status>
<credits>0.0</credits>
<startDate>1475993046000</startDate>
<courseSessionName><![CDATA[Onboarding Course]]></courseSessionName>
<maxGradePoints>100.0</maxGradePoints>
<award>false</award>
<completedPreRequisites>false</completedPreRequisites>
</courseSessionMember>
... <! -- in case of completed status -->
<courseSessionMember id="2fe1ddf0-8de6-11e6-a9c3-7b8f5d23978d" agreementAccepted="false" courseSessionId="d43e237e-6323-11e6-a6aa-51e7922605a9" late="false">
<userId>2fce8ff2-8de6-11e6-a9c3-7b8f5d23978d</userId>
<firstName><![CDATA[John]]></firstName>
<lastName><![CDATA[Doe>>]</lastName>
<userName><![CDATA[y4il*jdoe]]></userName>
<role>STUDENT</role>
<status>ACTIVE</status>
<credits>0.0</credits>
<startDate>1475993046000</startDate>
<courseSessionName><![CDATA[Onboarding Course]]></courseSessionName>
<maxGradePoints>100.0</maxGradePoints>
<percentGradePoints>100.0</percentGradePoints>
<gradePoints>100.0</gradePoints>
<award>true</award>
<awardDate>1475088791000</awardDate>
<completedPreRequisites>true</completedPreRequisites>
</courseSessionMember>
</data>
</response>
2. Response for unauthorized access
HTTP Response Code = HttpServletResponse.SC_UNAUTHORIZED
Response XML
<response code="-1">
<msgs>
<msg>
<code>0005</code>
<value><![CDATA[You are not allowed to perform this action.]]></value>
</msg>
</msgs>
</response>
3. Response on invalid filter (e.g. courseSessionId, extId, userId, openId)
By default, when an invalid filter is passed in input, API igonres the filter and returns the results without applying it. E.g. if you are searching for a specific course session, and did not pass a valid coursesession id, api will return results without filtering on course session. If you want the API to not return any results and return an error code for invalid filter, you should set the property
API_NO_RESULTS_ON_INVALID_FILTER = true
in the Site Admin->Site Details->Customization
<response code="0">
<msgs>
<msg>
<code>0004</code>
<value>
<![CDATA[ Unable to find CourseSession with matching 111. ]]>
</value>
</msg>
</msgs>
<data>
<programMembers numItems="0" currPage="-1" pageSize="10"></programMembers>
</data>
</response>
Code Snippet
/* Check API Call for detail generic code */
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("dispatch", "listCourseSessionMembers");
String retStr = connection.invokeApi("reportService.do", "chenry", parameters);
System.out.println(retStr);
API Documentation
Examples
- User Creation
- User Update
- User List
- Get User Details
- Add User to Group(s)
- Remove User from Group(s)
- User Activate
- User Deactivate
- User Login
- Group List
- Group Membership
- Course Subscription(Coupon Code)
- Subscribed Events List
- Non Subscribed Events List
- Test Instances in Microsite
- Forum APIs
- Javascript Example
Client Example
Quick Links
- Home
- Getting Started
- Knowledgebase
- Video Tutorials
- Google Apps Integration
- Gilly (Plugin for Atlassian Confluence)