Java API Call Examples
Getting Groups in a Site:
API: public String getSiteGroupList(String groupNamePattern, PagedList pagination);
groupNamePattern : this parameter can be set to name of the group which you like to fetch. It can also contain % as the wild card character. Groups are searched in case insensitive manner.
Example:
PagedList pagination = new PagedList(); String response = connector.getSiteGroupList(null, pagination); System.out.println(response); |
Getting Users in a Site:
API: public String getUserList(String searchStr, String groupId, Boolean inactive, Boolean enrolled, PagedList pagination)
searchStr : this parameter can be set to first, last name/ username / email of the user which you like to fetch. By default search is made for all tokens separated by spaces. So if you search for John Doe, it would match all John and all Doe and you may get more results than what you expected. It can also contain % as the wild card character. Search is done in case insensitive manner.
groupId : group id (guid) of the group from which you want fetch the users list. By passing the group id, you are able to get group members.
inactive : Set it to null to get both active and inactive users. To get only active users, set it to false. To get only inactive users set it to true.
enrolled : Set it to true to fetch only users who currently
Example:
PagedList pagination = new PagedList(); pagination.setPageSize(10); String response = connector.getUserList(null, null, false, null, pagination); System.out.println(response); |
Get User Details:
API: public String getUserDetails(String userName);
Example:
String response = connector.getUserDetails("jdoe"); System.out.println(response); |
Update User Details:
API: public String updateUserDetails(String userName, String firstName, String lastName, String email);
Example:
String response = connector.updateUserDetails("jdoe", "John", "Doe", "jdoe1@acme.com"); //Only first name, last name and email can be updated using this API |
Deactivate a User:
API: public String deactivateUser(String userName);
Example:
String response = connector.deactivateUser("jdoe"); System.out.println(response); |
Activate a User:
API: public String activateUser(String userName);
Example:
String response = connector.activateUser("ab11"); System.out.println(response); |
Sync group-users:
API: public boolean addRemoveGroupAndMembers(Map<String, List<String>> groupUsersMap, RolesEnum role, String addMemberOperation);
groupUsersMap: The Map (first parameter) contains one entry for each group, so group name is the key in this map. The values are list of String which contains the user's information. At a minimum the string in the list must have usernames. But they can also contain Email and First-Last name separated by pipe character.
role: Should be set to STUDENT
addMemberOperation: Last parameter in the API can be either add or remove . If set to add, only the new groupMembers would be created. If set to remove, then any existing groupMembers which is not passed in the List corresponding to a group, would be removed from the group. If set to both, then new members not already present in the group would be added to group and any member which is not passed in the List would be removed.
Example 1: This example shows how to add 3 users in two Groups Grp1 and Grp2. The group with these names may or may not be pre-existing in the site. If the group doesn't exist, it would get created. You can pass any number of groups and list of usernames in the respective group in a single API call.
Map<String, List<String>> groupUsersMap = new HashMap<String, List<String>>(); List<String> list = new ArrayList<String>(); list.add("user1|user1@ee.com|Fname1 Lname1"); list.add("user2|user2@ee.com|Fname2 Lname2"); list.add("user3|user3@ee.com|Fname3 Lname3"); groupUsersMap.put("Grp1", list); groupUsersMap.put("Grp2", list); boolean result = connector.addRemoveGroupAndMembers(groupUsersMap, RolesEnum.STUDENT, "add"); System.out.println(result); |
Example 2: This example shows how to remove all users from Grp1 except conf1 and conf2 . You can use similar call to remove a specific user from the group by passing complete list of group members excluding the one you want to remove.
Map<String, List<String>> groupUsersMap = new HashMap<String, List<String>>(); List<String> list = new ArrayList<String>(); list.add("conf1"); list.add("conf2"); groupUsersMap.put("Grp1", list); boolean result = connector.addRemoveGroupAndMembers(groupUsersMap, RolesEnum.STUDENT, "remove"); System.out.println(result); |
Related Pages
Group Management
Javascript
- Customization On Payment Page
- Validate IP Address while accessing the course
- UI Customization JavaScript Functions
- Verify Custom properties during Test Taking
- Verifying User Properties During Test
- JS Example
- example_custom_scripts
- Test Taking - Customization using callback mechanism
- Cms Calendar Example
Reports
Enrollment Management
- API - Update Event Subscription
- API - Create ExamTestInstance
- Update Program Member - via Program Session Id
- Update Program Member
- API - Self Enroll in Course Session
- Update Course Session Member
- API - Self Enroll in Program Session
- API - Self Enroll in Event
- API - Enroll Users in Course Session
- API - Enroll Users in Program Session
- API - Enroll Users in Event
- API - Enroll Users in Program
Other
Introduction
Report
- Get Sites Metadata
- Get Open Learning Items List
- API - Program Enrollment Summary
- API - Course Enrollment Summary
- Get Catalog Items List
- API - Course Session Members list
- API - Program Members List
- Event participants list
- Api - Test Attempts (Test Instances) List
- Test instance details list
- Api - Non Subscribed Event List
- Api - Subscribed Event List
- API - List All Report Schedules
- API - Get Latest Report Content For A Given Schedule ID
- API - Get Report Content For A Given Report ID
- API - List Reports For A Given Schedule
User Management
- API - User list
- API - Get user details
- Api - User Creation
- API - Create User (With Custom Properties)
- API - Update User
- API - Rename User
- API - Add user to group(s)
- API - Remove user from group(s)
- Merge User Accounts
- API - Activate User
- API - Deactivate User
- API - Change User's Origin Site
- Api - User Login (Creating User Session)
eCommerce
Quick Links
- Home
- Knowledgebase
- Video Tutorials
- Google Apps Integration
- Gilly (Plugin for Atlassian Confluence)
- EduBrite Mobile App for iPad
Gilly - EduBrite plugin for Confluence
Demo Url: http://gillydemo..edubrite.com
User: demo1, demo2
Password: password
EduBrite Mobile app for iPad
Download the app from app store
Demo Microsite: ipaddemo.edubrite.com
Signup from the app by selecting any username, and entering above demo url as training site url
EduBrite Business Edition
Demo Url: http://learnzone.edubrite.com
Signup as a user (trainee) and see the whole experience of enrolling and running the courses and tests
Group Management
Javascript
- Customization On Payment Page
- Validate IP Address while accessing the course
- UI Customization JavaScript Functions
- Verify Custom properties during Test Taking
- Verifying User Properties During Test
- JS Example
- example_custom_scripts
- Test Taking - Customization using callback mechanism
- Cms Calendar Example
Reports
Enrollment Management
- API - Update Event Subscription
- API - Create ExamTestInstance
- Update Program Member - via Program Session Id
- Update Program Member
- API - Self Enroll in Course Session
- Update Course Session Member
- API - Self Enroll in Program Session
- API - Self Enroll in Event
- API - Enroll Users in Course Session
- API - Enroll Users in Program Session
- API - Enroll Users in Event
- API - Enroll Users in Program
Other
Introduction
Report
- Get Sites Metadata
- Get Open Learning Items List
- API - Program Enrollment Summary
- API - Course Enrollment Summary
- Get Catalog Items List
- API - Course Session Members list
- API - Program Members List
- Event participants list
- Api - Test Attempts (Test Instances) List
- Test instance details list
- Api - Non Subscribed Event List
- Api - Subscribed Event List
- API - List All Report Schedules
- API - Get Latest Report Content For A Given Schedule ID
- API - Get Report Content For A Given Report ID
- API - List Reports For A Given Schedule
User Management
- API - User list
- API - Get user details
- Api - User Creation
- API - Create User (With Custom Properties)
- API - Update User
- API - Rename User
- API - Add user to group(s)
- API - Remove user from group(s)
- Merge User Accounts
- API - Activate User
- API - Deactivate User
- API - Change User's Origin Site
- Api - User Login (Creating User Session)
eCommerce
Quick Links
- Home
- Knowledgebase
- Video Tutorials
- Google Apps Integration
- Gilly (Plugin for Atlassian Confluence)
- EduBrite Mobile App for iPad
Gilly - EduBrite plugin for Confluence
Demo Url: http://gillydemo..edubrite.com
User: demo1, demo2
Password: password
EduBrite Mobile app for iPad
Download the app from app store
Demo Microsite: ipaddemo.edubrite.com
Signup from the app by selecting any username, and entering above demo url as training site url
EduBrite Business Edition
Demo Url: http://learnzone.edubrite.com
Signup as a user (trainee) and see the whole experience of enrolling and running the courses and tests
Comment