Wp-xapi-lrs Wordpress Plugin - Rating, Reviews, Demo & Download
Plugin Description
This WordPress plugin enables your WordPress site to act as an
xAPI enabled
Learning Record Store. At the time of writing, the support is very basic.
You can put statements in the database, and retreive them with some very basic
filtering, but that’s about it. It is possible to filter statements based on
agent, verb, activity, statementId and related_activities, which is a subset
from the complete list of filters found in the
xAPI standard.
How to use
After the plugin is installed, you will find a settings page called
xAPI LRS in the Settings section of the admin panel. On this page
you will find the endpoint as well as credentials that can be used to connect
to the LRS.
Testing from a hacker point of view
If you want to use this plugin in order to have a xAPI record store that other
systems can connect to, the above is all you need. However, if you are more of
a hacker type and you want to find out how xAPI actually works, this section is for you.
The username and password will be randomly generated upon
installation. We can try to access the endpoint using curl:
curl "http://8260a014ad6016ba2af2ed0c0f7684e0:7078d3dc378947905994affa86c20d48@localhost/wordpress/wp-content/plugins/wp-xapi-lrs/endpoint.php/"
{
"error": true,
"message": "Expected xAPI method, try appending /statements to the url."
}
This error message is given because according to the xAPI standard we need to specify which resource we want to access. Currently, the only implemented resource is the statements resource, so let’s try to access that:
curl "http://8260a014ad6016ba2af2ed0c0f7684e0:7078d3dc378947905994affa86c20d48@localhost/wordpress/wp-content/plugins/wp-xapi-lrs/endpoint.php/statements"
{
"statements": []
}
We are getting an empty list of statements back from the LRS, so something is working! Let’s try to put a statements there. We can take the hang gliding example from Statements 101. The statement looks like this:
{
"actor": {
"name": "Sally Glider",
"mbox": "mailto:sally@example.com"
},
"verb": {
"id": "http://adlnet.gov/expapi/verbs/experienced",
"display": { "en-US": "experienced" }
},
"object": {
"id": "http://example.com/activities/solo-hang-gliding",
"definition": {
"name": { "en-US": "Solo Hang Gliding" }
}
}
}
Put the statement in a file called statement.json. Insert the statement using the following curl command:
curl -X POST --data-binary @statement.json "http://8260a014ad6016ba2af2ed0c0f7684e0:7078d3dc378947905994affa86c20d48@localhost/wordpress/wp-content/plugins/wp-xapi-lrs/endpoint.php/statements"
[
"e1dc2120-ca22-4500-96a2-611b32edfb70"
]
It worked! The data we got back is the UUID for the statement. Let’s try to retreive it:
curl "http://8260a014ad6016ba2af2ed0c0f7684e0:7078d3dc378947905994affa86c20d48@localhost/wordpress/wp-content/plugins/wp-xapi-lrs/endpoint.php/statements"
{
"statements": [
{
"id": "e1dc2120-ca22-4500-96a2-611b32edfb70",
"stored": "2016-11-07T09:44:53.000+00:00",
"actor": {
"objectType": "Agent",
"name": "Sally Glider",
"mbox": "mailto:sally@example.com"
},
"verb": {
"id": "http://adlnet.gov/expapi/verbs/experienced",
"display": {
"en-US": "experienced"
}
},
"timestamp": "2016-11-07T09:44:53.000+00:00",
"object": {
"objectType": "Activity",
"id": "http://example.com/activities/solo-hang-gliding",
"definition": {
"name": {
"en-US": "Solo Hang Gliding"
}
}
}
}
]
}
Yep, it seems like the statement is there!
Hacking and Development
Some small things to think about if you want to contribute to this plugin:
-
Don’t update the README.md file. Update the readme.txt file, then build the
README.md file usingmake readme
. This in turn uses the
wp2md command,
so this needs to be installed on your system. -
The minixapi module is linked as a
git submodule, under thesubmodule
directory. However, as a convenience it
is also copied and checked in to this repository under theext
directory.
In order to keep these copies in sync, you can run the commandmake copy-deps
to copy the contents of the submodule to the ext directory. If you want to
work on the submodule at the same time as you work on this repository, you
can use the commandmake link-deps
to create a symbolic link from theext
directory to thesubmodule
directory. We want the copy of the submodule
checked in to the repository, and not the link, so don’t forget to run
make copy-deps
before you add files and commit!
Screenshots
No screenshots provided