Thursday, March 20, 2008

API 101

We just finished a fairly intensive training session here in Hong Kong with a couple of partners. The subject was ostensibly our customization toolkit, but we also spent quite a bit of time discussing APIs and how EKP can be integrated with existing web sites, portals and applications. Every time we conduct these training sessions, this topic expands.

Here's an outline of what we covered, with links to the relevant documentation.

  1. The first step in seamlessly combining EKP functionality with an existing site is understanding how to implement web-based single sign-on.
  2. With a single sign-on mechanism in place, it's possible to have external pages link directly to specific pages in EKP, and, in particular, to launch courses directly from external pages. (See also: How can I link directly to a page in EKP without losing the navigation frames?)
  3. Data can be manipulated in, or extracted from, EKP using the APIs described in the EKP APIs and Web Services Overview. Examples:
    • To ensure that EKP has a user account for a specific user ID (as part of the single sign-on process for example), have the external site send a direct server-to-server HTTP POST request to /ekp/contentHandler/usersCsv, with CSV-formatted data (following the User Data Loader format) in the body of the request. Note that most of the columns are optional when the User Data Loader format is used, so the following is valid for example:
      Action,UserID,Password,FamilyName,GivenName
      A,joestudent,mypassword,Student,Joe
    • To ensure that a specific user is enrolled in a specific course (prior to launching the course for example), have the external site send a direct server-to-server HTTP POST request to /ekp/enrollmentHandler with CSV-formatted data in the body of the request. For example:
      USERID,LEARNINGID
      joestudent,Derivatives_101
    • To retrieve a complete training history, in XML format, for user joestudent (to display within an external page for example), have the external site send a direct server-to-server HTTP GET request to /ekp/contentGenerator/trainingHistoryXml?userId=joestudent.

Update: I posted Java code samples for creating a user account and enrolling a user in a course.

Update 2: Musings on the invocation style of the API operations discussed above, prompted by Carfield's comment.

2 comments:

Anonymous said...

Will there any plan of having more service like api which look like

/ekp/service/updateUser?userId=joestudent&firstname=new_name

I was guessing most user use service like

/ekp/contentGenerator/trainingHistoryXml?userId=joestudent

Is actually need limited propose, they are not really need to have all the user data to do everything

Robert Lowe said...

Carfield, I have responded to this in a follow-up post.