-
Notifications
You must be signed in to change notification settings - Fork 0
Write a statement
Oliver Pincus edited this page Jan 30, 2019
·
16 revisions
As a xAPI statement is a JSON object sent to the Learning Record Store (LRS), there are many options to write a statement.
- Go to https://adlnet.github.io/xapi-lab/.
- Fill out the form
- Get the statement from the Statement Editor box.
{
"actor": {
"account": {
"name": "Guest"
},
"objectType": "Agent"
},
"verb": {
"id": "http://adlnet.gov/expapi/verbs/launched",
"display": {
"en-US": "launched"
}
},
"object": {
"id": "https://xapistatementbox.github.io",
"definition": {
"description": {
"en-US": "Demo"
}
},
"objectType": "Activity"
}
}
- Create a HTML page.
- Download script from https://github.com/adlnet/xAPIWrapper and embed.
<script type="text/javascript" src="js/xapiwrapper.min.js"></script>
- Add JavaScript to create statement.
//define the xapi statement being sent from scratch
var statement = new ADL.XAPIStatement(
new ADL.XAPIStatement.Agent(ADL.XAPIWrapper.hash('mailto:guest@URL.url'), 'Guest'),
new ADL.XAPIStatement.Verb('http://adlnet.gov/expapi/verbs/launched', 'launched'),
new ADL.XAPIStatement.Activity('https://xapistatementbox.github.io', 'Demo')
);
-
Get string from the JSON object.
JSON.stringify(statement, null, 4)
The above example writes this statement:
{
"actor": {
"objectType": "Agent",
"name": "Guest",
"mbox_sha1sum": "eebc17aa5e5dbf9a5a291d47063c6d296f3ebd62"
},
"verb": {
"id": "http://adlnet.gov/expapi/verbs/launched",
"display": {
"en-US": "launched"
}
},
"object": {
"objectType": "Activity",
"id": "https://xapistatementbox.github.io",
"definition": {
"name": {
"en-US": "Demo"
}
}
}
}
- Open a text editor.
- Write the statement from scratch as JSON.