LilxAPI

LilxAPI is a simpler, flat version of an xAPI statement. Each statement is required to have only three properties: actor, verb, and object. Each property is limited to a single value. Statements may be represented either as a JSON object with name-value pairs or as an array of values.

LilxAPI (or Lil' xAPI) is a simpler, flat version of an xAPI statement that allows it to be easily stored in a finite data structure, such as a spreadsheet or single table of a SQL database. In this simplified approach, each statement is required to have only three properties: actor, verb, and object. Each property is limited to a single value. Statements may be represented either as a JSON object with name-value pairs or as an array of values (using the numeric array keys provided in Table 1).

Table 1

Overview of the LilxAPI structure

namedescriptionvalue formatdefaultexamplearray key
actorThe identity of the actor.stringrequired"janedoe@fake.com, Jane Doe"
"janedoe@fake.com"
"Jane Doe" or "janedoe1234" or "1234"
0
verbThe action performed by the actor.human-readable termrequired"completed", "clicked", "interacted", "viewed", "answered", etc.1
objectThe target of the statement or what the actor interacted with.urlrequired"https://edtechbooks.org/education_research/research"2
resultThe outcome of the action.float
boolean
string
null.75
true
"success"
3
contextContextual information about the action.stringnull"web"
"app"
4
language_idThe language of the schema.ISO 639-1 Formaten"en" or "fr" or "sp"5
timestampThe time of the interaction.ISO 8601 formatcurrent time"2023-11-10T12:34:56Z"6
xapiThe fully rendered xAPI statement.jsonnull-7

Example Statements

An Actor Viewed a Page

Object format

{
  "actor": "janedoe@fake.com",
  "verb": "viewed",
  "object": "https://edtechbooks.org/education_research/research"
}

Array format

["janedoe@fake.com", "viewed", "https://edtechbooks.org/education_research/research"]

An Actor Correctly Answered a Question

Object Format

{
  "actor": "janedoe@fake.com",
  "verb": "viewed",
  "object": "https://edtechbooks.org/education_research/research#question1",
  "result": true

}

Array Format

["janedoe@fake.com", "answered", "https://edtechbooks.org/education_research/research#question1", true]

EdTech Books as LRS Example

You can create an ETB API key for your project by logging in and going to the Developer dashboard in the top-right menu. This requires developer access, which you can request by contacting a site admin.

screenshot of lilxapi statements stored in ETB

Google Sheets Automation

You can build charts and graphs in Google Sheets for dashboards and reports and then automate the download of LilxAPI statements using the ImportData function and appending the &format=csv value to your endpoint. An example endpoint for this purpose follows:

https://edtechbooks.org/api.v2.php?action=lilxapi_get&format=csv&api_key=YOURAPIKEY 

Excel Automation

You can build charts and graphs in Excel for dashboards and reports and then automate the download of LilxAPI statements. Here is an example automation script that can be included in Excel to pull data directly from ETB:

const apiKey = "YOURAPIKEYHERE";
interface ExcelRow {
statement_id: number;
author_id: number;
actor: string;
verb: string;
object: string;
result: string;
context: string;
language_id: string;
timestamp: string;
xapi: string
}

async function main(workbook: ExcelScript.Workbook) {
const data = await fetchData();
console.log(JSON.parse(data.json));
const json: ExcelRow[] = JSON.parse(data.json);
const newWorksheet = workbook.getActiveWorksheet();
newWorksheet.activate();
const headingRange = newWorksheet.getRangeByIndexes(
0,
0,
1,
Object.keys(json[0]).length);
console.log(Object.keys(json[0]));
headingRange.setValues([Object.keys(json[0])]);
const dataRange = newWorksheet.getRangeByIndexes(
1,
0,
json.length,
Object.keys(json[0]).length);

dataRange.setValues(json.map(row => Object.values(row)));
}
async function fetchData(): Promise<string[][]> {
const apiUrl = "https://edtechbooks.org/api.v2.php?action=lilxapi_get&api_key=" + apiKey;
const response = await fetch(apiUrl);
if (!response.ok) {
throw new Error(`Failed to fetch data. Status: ${response.status}`);
}
const jsonData: ExcelRow[] = await response.json();
return jsonData;
}


This content is provided to you freely by EdTech Books.

Access it online or download it at https://edtechbooks.org/elearning_hacker/lilxapi.