The following example shows authentication using curl commands. Anybody who needs to make API calls to fetch and update data into their microsite through HTTP calls can refer these.
- Setup initial call to get SESSION_ID . This curl request will store response cookies in cookies.txt
curl --cookie-jar cookies.txt https://<microsite-url>/oltpublish/site/connect.do |
2. Authenticate with api_username and password. Pass in the SESSION_ID cookie returned in #1. In below
curl -b cookies.txt --cookie-jar authenticated.txt --data "username=<api_username>&password=<password>" https://<microsite-url>/oltpublish/site/index.do |
3. Sample API call to return user lists. This is authenticated API to get the list of users. Similarly, other authenticated API calls can be made.
header REAL_UNAME with format uname+"|"+(email != null?email:"")+"|"+(flname!=null?flname:"")
Example value for REAL_UNAME: "jdoe|jdoe@edubrite.com|John Doe"
If you don't want to pass email and fullname, you can simply use user name
REAL_UNAME: jdoe
curl -b authenticated.txt --header "REAL_UNAME:jdoe" https://<microsite-url>/oltpublish/site/userService.do?dispatch=list |
Creating user session in browser
To create user session using API, and bypassing the signin page of lms you can use the createSessionAPI. E.g.
curl -b authenticated.txt --header "REAL_UNAME:jdoe" https://<microsite-url>/oltpublish/site/signinService.do?dispatch=createSessionApi |
Sample response you will get upon successful call
<response code="0"> <msgs> <msg> <code>0</code> <value> <![CDATA[Success]]> </value> </msg> </msgs> <data> <session> <sessionId><![CDATA[0Gxxkt0dw_utQpcg6Ca2kt9iMuoQs7u70RJjRHmt5osmgnTZcqVo2PJX8JeMDeKEM8O5RE*]]></sessionId> <sessionInfo><![CDATA[0Gxxkt0dw_uOSLTPtQpcgyrfJ6eFZnIpRKe-uzilq4kjDfv8OG9BNRaPvoe_5rkSZuRNHC-S7IPlVibmzDnEe4LcGOaD4CJbv9nnzEw*]]></sessionInfo> </session> </data> </response> |
Once you have the SessionId and SessionInfo, you can open the browser with below url and lms will recognize you as a valid signed in user jdoe.
https://<microsite-url>/oltpublish/site/index.do?sessionId=<replace session-id>&sInfo=<replace session-info>
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
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)
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
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)