User List
This API can be used to get users in the microsite. 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
userService.do
Parameter 2 - UserName
Username of any site administrator
Parameter 3 - Request Parameters
Name | Value |
dispatch | list |
Optional Search Parameters | |
search | username / first / last name / email to search for. Can use wild card * . If multiple words are present then all words are matched. |
inactive | true | false (to search for active or inactive users) |
activeEnrollment | true | false (to search for users who have any active enrollment in any course session) |
fromDate | user created or modified from |
toDate | user created or modified till |
dateFilterMode |
Can be CREATED_DATE or MODIFIED_DATE or ALL. Set one of the above to filter list based on from/to dates of created, modified or either dates. |
dateFilterIgnoreTime | true | false - set to do from/to date comparison based on beginning of day/end of day or date time based. |
groupId | comma separated list of group ids to search the users from. |
groupName | name of the group (if ids are not specified) to search the users from |
siteRole | STUDENT | INSTRUCTOR | ADMIN (users role in microsite) |
Searchable custom properties can be passed as map | |
customPropertyMap['address'] | 4128 Business Center Drive |
customPropertyMap['department'] | sales |
Optional additional parameters | |
pwToken | true. Optional, pass true to retrieve password reset token and password reset urls for users. |
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 |
Response
1. Response on successfully finding users
HTTP Response Code = HttpServletResponse.SC_OK
Response XML
<response code="0">
<msgs>
<msg>
<code>0</code>
<value><![CDATA[Success]]></value>
</msg>
</msgs>
<data>
<users numItems="4282" currPage="0">
<user id="e608d414-2160-11e6-b63c-6ce229284b01">
<!-- user name consists of namespace for the site, then asterisk, then actual username. To pass username in any api call, input must not contain the namespace and asterisk. -->
<userName><![CDATA[xze4*rross]]></userName>
<firstName><![CDATA[Ronald]]></firstName>
<lastName><![CDATA[Ross]]></lastName>
<passwordToken><![CDATA[xxxxxxxxxx]]></passwordToken>
<passwordResetUrl><![CDATA[http://microsite-url.edubrite.us/oltpublish/site/resetpasswd.do?token=xxxxxxxxxxxxx]]></passwordResetUrl>
<status><![CDATA[ACTIVE]]></status>
<properties> <!-- custom properties defined in your microsite -->
<property>
<name><![CDATA[ DOB ]]></name>
<value><![CDATA[ 08/21/2018 ]]></value>
<displayValue><![CDATA[ 08/21/2018 ]]></displayValue>
</property>
<property>
<name><![CDATA[ Department ]]></name>
<value><![CDATA[ sales ]]></value>
<displayValue><![CDATA[ Sales ]]></displayValue>
</property>
...
</properties>
<createdDate>1532214190000</createdDate>
<createdBy>
<![CDATA[ api_e85ad12c-2ef1-11e8-ab3a-0327bc39e9e4 ]]>
</createdBy>
<modifiedDate>1533844233000</modifiedDate>
<modifiedBy>
<![CDATA[ xze4*admin ]]>
</modifiedBy>
</user>
<user id="e242476e-215d-11e6-b63c-6ce229284b01">
<userName><![CDATA[xze4*jdoe]]></userName>
<firstName><![CDATA[John]]></firstName>
<lastName><![CDATA[Doe]]></lastName>
<passwordToken><![CDATA[xxxxxxxxxx]]></passwordToken>
<passwordResetUrl><![CDATA[http://microsite-url.edubrite.us/oltpublish/site/resetpasswd.do?token=xxxxxxxxxxxxx]]></passwordResetUrl>
<status><![CDATA[ACTIVE]]></status>
...
</user>
<user id="657b764c-215d-11e6-b63c-6ce229284b01">
<userName><![CDATA[xze4*swilson]]></userName>
<firstName><![CDATA[Steve]]></firstName>
<lastName><![CDATA[Wilson]]></lastName>
<passwordToken><![CDATA[xxxxxxxxxx]]></passwordToken>
<passwordResetUrl><![CDATA[http://microsite-url.edubrite.us/oltpublish/site/resetpasswd.do?token=xxxxxxxxxxxxx]]></passwordResetUrl>
<status><![CDATA[ACTIVE]]></status>
....
</user>
....
.....
</users>
</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>
Code Snippet
/* Check API Call for detail generic code */
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("dispatch", "list");
parameters.put("search", "john doe");
String retStr = connection.invokeApi("userService.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)