Sending xAPI Statements
This guide explains how to send learning activity data to LearnCloud using the xAPI (Experience API) standard. LearnCloud is a service that collects and tracks learning experiences across different pl
Overview
Prerequisites
Before you begin, you'll need:
A LearnCloud-provided JWT token for authentication
A DID (Decentralized Identifier) for the user
The LearnCloud xAPI endpoint URL
If you don't have any of these, check out the Game Flow docs and come back here.
Understanding Key Concepts
What is xAPI?
xAPI (Experience API) is a specification that allows you to track learning experiences. It uses a simple structure of "Actor - Verb - Object" to describe activities, similar to how you might say "John completed the course" in plain English.
What is a DID?
A DID (Decentralized Identifier) is a unique identifier for your user that works across different systems. Think of it like an email address that works everywhere but is more secure and private.
Basic Implementation
Here's how to send an xAPI statement to LearnCloud:
Tracking Game Activities
Here are examples of tracking different activities in a skills-building game:
1. Tracking Activity Attempts
2. Tracking Skill Development
3. Tracking Achievements with Results
Common Gotchas and Tips
DID Usage: Always use the same DID in both
actor.name
andactor.account.name
. This DID should come from your authentication process.Verb Selection: Use standard xAPI verbs when possible. Common ones include:
attempted
completed
mastered
demonstrated
failed
progressed
Activity IDs: Use consistent, unique URLs for your activity IDs. They don't need to be real URLs, but they should be unique identifiers following URL format.
Authentication: The JWT token should be sent in the
X-VP
header. This is specific to LearnCloud's implementation.Error Handling: Always implement proper error handling:
Testing Your Implementation
Before sending real user data, test your implementation with sample statements. Verify that:
The authentication works (200 status code)
The statements are properly formatted
The DIDs are correctly included in both required locations
The verbs and activity types make sense for your use case
Need Help?
If you encounter issues or need clarification:
Check that your JWT token is valid
Verify your statement structure matches the examples
Ensure all required fields are present
Contact LearnCloud support if issues persist
Last updated
Was this helpful?