xAPI.js
  • xAPI.js
  • xAPI Wrapper Library
    • Introduction
    • Getting Started
    • The XAPI Class
    • Statement Resource
    • State Resource
    • Activity Profile Resource
    • Agent Profile Resource
    • About Resource
    • Agents Resource
    • Activities Resource
    • Helpers
    • Verbs
    • Attachment Usages
  • cmi5 Profile Library
    • Introduction
    • Getting Started
    • The Cmi5 Class
    • "cmi5 defined" Statement methods
    • "cmi5 allowed" Statement methods
    • Helpers
Powered by GitBook
On this page
  • new XAPI()
  • Parameters
  • Returns

Was this helpful?

  1. xAPI Wrapper Library

The XAPI Class

The xAPI class which manages the communication with the LRS.

PreviousGetting StartedNextStatement Resource

Last updated 9 months ago

Was this helpful?

new XAPI()

To use any of the Resources, you will need to create a new instance of with credentials.

const endpoint = "https://my-lms.com/endpoint/";
const auth = XAPI.toBasicAuth(username, password);
const xapi = new XAPI({
  endpoint: endpoint,
  auth: auth
});

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

false

The version of xAPI to use. Defaults to 1.0.3.

adapter

false

The underlying adapter to make HTTP requests with. Accepts axios, fetch or a custom adapter function. Defaults to axios.

Returns

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

XAPI
XAPI
Versions
Adapter