Demystifying Experience API (xAPI)

Lenin Lakshminarayanan
6 min readJun 5, 2024

--

In this three-part series, we will explore xAPI (Experience API) in detail, covering its use cases, common pitfalls to watch out for, and more.

In this segment, we’ll dive into the following topics:

  1. What is xAPI
  2. Capturing learning experiences through xAPI Statements
  3. Architecture of xAPI
  4. Sample flow of xAPI data end to end

What is xAPI (Experience API)

xAPI, short for Experience API, is a standard used in eLearning that lets you “track” and “record” your learning experiences in greater detail. Whether you’re taking an online course, playing a mobile game, attending a webinar, or joining a conference, xAPI tracks all these activities down to the smallest details.

It’s like having a digital logbook that captures every aspect of your learning journey, whether it’s online, offline, in-person, or across different devices and apps. This standardized tracking system allows various tools and platforms to easily share and understand your learning data, regardless of where or how you’re learning.

Capturing learning experience — xAPI Statements

If xAPI allows us to meticulously “track” and “record” learning experiences, two questions arise: a) How are these experiences captured? and b) What specific data is recorded about each experience? This is where xAPI statements become essential.

xAPI Statements serve as the evidence for any learning experience to be tracked within xAPI. They are straightforward JSON documents capturing a learning activity or experience, comprising of three main components.

  1. Actor (Who): Represents the individual or an entity performing the action. This could be a learner, instructor, system, or any other entity involved in the learning process. The actor is typically identified by a unique identifier, such as an email address or some other unique identifier.
  2. Verb (Did What): Describes the action or activity performed by the actor. Common verbs include “completed,” “launched,” “attempted,” “answered,” etc. Verbs provide context about what the actor did during the learning experience.
  3. Object (On What): Represents the target or object of the action. This could be a course, module, quiz or exam, video, document, game simulation, or any other learning resource or activity. The object provides information about what the actor interacted with or acted upon.

Furthermore, xAPI statements may encompass additional optional components beyond the core three. These could entail a timestamp, result data (e.g., score, completion status in quizzes, exams, or assessment activities), context (e.g., platform, language, course-specific details, or any other pertinent information relevant to the learning experience captured), and extensions for supplementary custom metadata.

Here is a sample xAPI statement:

{
"actor": {
"mbox": "john.smith@sampledomain.com",
"name": "John Doe"
},
"verb": {
"id": "http://adlnet.gov/expapi/verbs/completed",
"display": {
"en": "completed"
}
},
"object": {
"id": "http://example.com/courses/intro-to-xapi",
"definition": {
"name": {
"en": "Introduction to xAPI"
}
"type": "http://adlnet.gov/expapi/activities/course",
}
},
"timestamp": "2024-06-01T15:00:00Z"
}

The way to interpret this statement is: John Smith (actor) completed (verb) the course “Introduction to xAPI” (object) at 15:00 PM on June 1st, 2024 (as shown and marked below):

Architecture of xAPI

Major components in xAPI architecture

The architecture of xAPI (Experience API) is designed to support comprehensive tracking and recording of learning experiences across various environments and platforms. Let’s look at it’s key components:

  1. Actor (Learner): The individual, or learner, who engages in the learning activity. Each actor is distinctly identified, typically by an email address or another unique identifier.
  2. Activity Provider: In simple terms, any system that generates xAPI statements is known as an activity provider. This may be an LMS (Learning Management System), a mobile app, a simulation, a game, a social learning platform, or any other tool where learning activities take place. Learning activities are ‘tracked’ and ‘recorded’ by generating xAPI statements, which are then sent to and stored in the LRS (a data store). The activity provider is the component responsible for generating and sending these xAPI statements to the LRS.
  3. Learning Record Store (LRS): A specialized data storage system designed to receive, store, and retrieve xAPI statements. The LRS acts as a centralized repository where all learning activity data is stored, enabling analysis and reporting. It can function as an integral component within an LMS (Learning Management System) or operate independently as a standalone service.
  4. Consumers: Systems or applications that retrieve data from the LRS for analysis, reporting, or other functions. Consumers can derive insights, visualize learning data, monitor progress, and aid decision-making processes.

Sample Flow of xAPI Data End to End

  1. Learner Interaction: The “learner” typically interacts with an activity hosted by an “activity provider.” This activity could be anything from “reading some material in a course,” “taking a quiz or an exam,” “submitting a due assignment,” “playing a game related to the learning content,” or any other educational task.
  2. xAPI Statement Generation: As the learner interacts with the activity, the activity provider generates xAPI statements to capture the learning experience. These statements might look something like “John completed AI course,” “John attempted to answer this question,” “John submitted this exam in the AI course,” etc. Shown below is a sample xAPI statement to capture “John Smith launched an AI course”.
{
"actor": {
"mbox": "john.smith@sampledomain.com",
"name": "John Smith"
},
"verb": {
"id": "http://adlnet.gov/expapi/verbs/launched",
"display": { "en-US": "launched" }
},
"object": {
"id": "http://sampledomain.com/activities/ai-course",
"definition": {
"name": { "en-US": "AI Course" },
"type": "http://adlnet.gov/expapi/activities/course",
}
},
"timestamp": "2024-06-05T12:34:56Z"
}

3. Send xAPI Statement: Now that xAPI statements are generated by the activity provider, they are ready to be sent to a data store for further consumption. Activity providers typically send the xAPI statements to an LRS system, through an API endpoint. Shown below is a sample POST request to send xAPI statements to an LRS:

POST /statements
Host: lrs.sampledomain.com
Content-Type: application/json
Authorization: Basic <credentials>
{
"actor": {
"mbox": "john.smith@sampledomain.com",
"name": "John Smith"
},
"verb": {
"id": "http://adlnet.gov/expapi/verbs/launched",
"display": { "en-US": "launched" }
},
"object": {
"id": "http://sampledomain.com/activities/ai-course",
"definition": {
"name": { "en-US": "AI Course" },
"type": "http://adlnet.gov/expapi/activities/course",
}
},
"timestamp": "2024-06-05T12:34:56Z"
}

4. Receive xAPI Statements: LRS receives these statements and stores them.

5. Data retrieval: Once the learner interactions are stored in LRS, consumer applications, typically analytics platforms, can query the LRS to retrieve all learning activities of a learner, through an API endpoint, as shown below.

GET /statements?agent={"mbox":"john.smith@sampledomain.com"}
Host: lrs.sampledomain.com
Authorization: Basic <credentials>

6. Analytics and Reporting: The analytics platform may process the gathered data, generating comprehensive reports and visualizations. This data can be scrutinized to assess a learner’s performance within a course, module, or any specific activity, or to extract behavioral patterns and insights regarding user engagement, among other potential applications.

For instance, a progress report for John might state: “John has completed 70% of the AI course, achieved an 80% score on the initial quiz, and submitted the initial assignment punctually.” However, this analysis transcends mere progress tracking; it unveils a plethora of possibilities by harnessing the detailed information provided by learners. Let’s delve into these possibilities and beyond in the upcoming segments.

Conclusion

In essence, xAPI holds transformative potential in revolutionizing how learning experiences are tracked, analyzed, and optimized. It empowers organizations to capture a wide array of learning activities across multiple platforms and devices, offering a comprehensive understanding of the learner’s progression. Moreover, xAPI data can be utilized to tailor learning experiences, pinpoint areas for enhancement, provide timely student interventions to prevent dropouts, and facilitate data-driven decision-making in educational endeavors. Overall, xAPI plays a significant role in shaping the future landscape of learning analytics, with its profound ability to elevate learning outcomes and foster learner engagement.

Related Articles:

  1. How to get started with xAPI?
  2. Scaling xapi
  3. State Management in xAPI

--

--

Lenin Lakshminarayanan
0 Followers

Passionate about learning and making new ideas accessible to everyone!