The table below describes the routes that the HTTP interface provides, all of the URLs are relative to http://www.example.org/data/xAPI where http://www.example.org is the URL of your Learning Locker instance. To access this interface, you must additionally supply your Basic Auth details with each request in the Authorization header. Your Basic Auth details can be found under Settings > Clients.
If you receive an "unauthorised error" from this API, you can use the three checks below via the Client UI. To remove the need for these checks, Learning Locker will automatically create a new client when a new store is created, the new client is enabled by default, with the "All" scope, and the LRS set to the new store. To avoid unauthorised errors, try to use the new client and remember the checks below if you edit or create a client manually.
Check that the client is enabled.
Check that the "All" scope is selected under the "xAPI" heading.
This route allows you to create a single statement with a statement identifier in the URL parameters and the statement itself in the JSON body. A request to this API would look something like the request below.
In addition to the statementId and voidedStatementId URL parameters (one of which must be set to retrieve a single statement), there are two additional optional parameters in the form of format and attachments. The format parameter defaults to "exact" if it's not set, the other options are "ids" (only includes minimal information) and "canonical" (only includes one language per language map). The attachments parameter is a boolean that determines if the statement's attachments are returned with the statement.
When getting a single statement successfully, this route will return a 200 response as shown below with the statement as the body of the request. If the single statement cannot be found, then this route will return a 404 response.
When retrieving multiple statements there are a number of optional URL parameters listed below that can be used to filter statements. All of the URL parameters should be URL encoded (after JSON encoding if JSON encoding is required).
JSON encoded object containing an IFI to match an agent or group.
String matching the statement's verb identifier.
String matching the statement's object identifier.
String matching the statement's registration from the context.
Applies the activity filter to any activity in the statement when true. Defaults to false.
Applies the activity filter to any agent/group in the statement when true. Defaults to false.
String that returns statements stored after the given timestamp (exclusive).
String that returns statements stored before the given timestamp (inclusive).
Number of statements to return. Defaults to 0 which returns the maximum the server will allow.
String ("exact"/"ids"/"canonical") determining how much of the statement is returned. Defaults to "exact" to return the full statement.
Boolean determining if the statements' attachments should be returned. Defaults to false.
Boolean determining if the statements should be returned in ascending stored order. Defaults to false.
Below is an example of a request containing each of the URL parameters.
This route will return a 200 response as shown below where the JSON body of the response contains a more link and an array of statements that match the URL parameters. The more link can be used to retrieve the next page of statements, if there aren't any more pages of statements the more link will be an empty string.