The XAPI Class
The xAPI class which manages the communication with the LRS.

new XAPI()

To use any of the Resources, you will need to create a new instance of XAPI with credentials.
1
const endpoint = "https://my-lms.com/endpoint/";
2
const auth = XAPI.toBasicAuth(username, password);
3
const xapi = new XAPI({
4
endpoint: endpoint,
5
auth: auth
6
});
Copied!

Parameters

Parameter
Type
Required
Description
endpoint
string
true
The URL of the endpoint.
auth
string
false
The Authorization header value to be appended to all requests. Defaults to Basic 0g==, which is equivalent of Basic followed by a base64 encoded version of the string :.
version
Versions
false
The version of xAPI to use. Defaults to 1.0.3.

Returns

This returns an XAPI object which you can use to communicate with the LRS.