-
Notifications
You must be signed in to change notification settings - Fork 2
/
readme.txt
128 lines (110 loc) · 5.87 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
=== wp-xapi-lrs ===
Contributors: Tunapanda
Donate link: http://www.tunapanda.org/contribute
Tags: xapi, admin, learning, integration, lms, learning management system
Requires at least: 3.8.1
Tested up to: 4.7.1
Stable tag: trunk
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Lets your WordPress site to act as an xAPI Learning Record Store.
== Description ==
This WordPress plugin enables your WordPress site to act as an
[xAPI](https://en.wikipedia.org/wiki/Experience_API_(Tin_Can_API)) 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](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Communication.md#213-get-statements).
= 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](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Communication.md#21-statement-resource) 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](https://experienceapi.com/statements-101/) example from Statements 101. The statement looks like this:
{
"actor": {
"name": "Sally Glider",
"mbox": "mailto:[email protected]"
},
"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](https://en.wikipedia.org/wiki/Universally_unique_identifier) 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:[email protected]"
},
"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 using `make readme`. This in turn uses the
[wp2md](https://github.com/wpreadme2markdown/wp-readme-to-markdown) command,
so this needs to be installed on your system.
* The [minixapi](https://github.com/limikael/minixapi/) module is linked as a
git submodule, under the `submodule` directory. However, as a convenience it
is also copied and checked in to this repository under the `ext` directory.
In order to keep these copies in sync, you can run the command `make 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 command `make link-deps` to create a symbolic link from the `ext`
directory to the `submodule` 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!