The Usage API is a (limited) TinCan API used to report usage statistics to Elucidat. The same TinCan statements can be sent to your own LRS simulateously if you choose to use that option.
You must see if there are any active sessions (registrations) for the specified user. This will return a registration (session) id which is required for any subsequent calls. This is illustrated below.
This API is designed to be used from Javascript by an unauthenticated user, so it can only use Basic Authentication. Elucidat do not support GET methods to retrieve arbitrary user data.
Authentication credentials are generally only valid for 24 hours.
A description of our supported statements are here:
Verbs | Description |
---|---|
attempted | Notifies the LRS that a course has begun. |
experienced | Sent when a page has been viewed. |
answered | Sent when a page is a scored page and a score has been sent.
|
completed | Used when a course has been completed and completion is based on the number of pages. |
passed | Notifies the LMS that a course has been completed with a passing score. This verb is only used when completion is based on a pass/fail. |
failed | Notifies the LMS that a course has been completed with a failing score. This verb is only used when completion is based on a pass/fail.
|
terminated | Notifies the LMS that the Learner has completed the course and got to the last page - so if they come back, their history should be ignored. |
Javascript
$.ajax({
url: 'https://api.elucidat.com/usage/state',
type: 'GET',
dataType: "json",
data: {
activityId: "https://learning.elucidat.com/course/606efd6593024-60700c170ae6b",
agent: JSON.stringify( {
"mbox": "mailto:nick.cooke@elucidat.com",
"name": "Nick Cooke",
"objectType": "Agent"
} )
},
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic NjAzM2Q2NzUwYzRlYzpTbmRQU0ZZeVVGUXJRMlZRUm5SallXNDVNR1ppTnprM2VGaElaak5ST1ZaUWEzb3lPRTlISzFGeGNFY3lWelZaVml0Tk4yMUhSa054VGxGMmVucE1Semx2TVZSd2RrRkdVbmwyWVZoNWVURXhZMWszU3pOd2FYaFljSEJ5TXpaaFVYWmpUME5zU0dKUlN6QTk=");
xhr.setRequestHeader ("X-Experience-API-Version", "1.0.0");
},
success: function(response, textStatus, xhr) {
// take the registration, and save it for subsequent calls
if (response.registration)
registration = response.registration;
},
error: function(xhr) {
console.log("Error calling API, status code " + xhr.status + ", message: " + xhr.responseText);
}
});