As you may know, the xAPI specification defines a standard API which has some limitations. TRAX LRS provides an extended API which gives you more options to manipulate xAPI data.
This API relies on TRAX LRS data models.
In order to acces the extended API, you must create a client and access with extra permissions:
Then, get the access endpoint and replace std
by ext
at the end of the URL.
You have now the endpoint of the extended API.
Get a statement given its internal database ID.
Get the statements matching with the request parameters as specified at the end of this document.
This API provides additional filters:
Parameter | Description |
---|---|
uiActor | Search on the actor (see UI field) |
uiVerb | Search on the verb (see UI field) |
uiObject | Search on the object (see UI field) |
uiContext | Search on the context (see UI field) |
statementId | As defined by the xAPI spec |
voidedStatementId | As defined by the xAPI spec |
agent | As defined by the xAPI spec |
verb | As defined by the xAPI spec |
activity | As defined by the xAPI spec |
registration | As defined by the xAPI spec |
related_activities | As defined by the xAPI spec |
related_agents | As defined by the xAPI spec |
since | As defined by the xAPI spec |
until | As defined by the xAPI spec |
This API provides specific options:
Parameter | Description |
---|---|
reveal | Reveal the returned statements if they were pseudonymized |
Count the statements matching with the request parameters as specified at the end of this document.
Delete a statement given its internal database ID.
Delete the statements matching with the request parameters as specified at the end of this document.
Create an activity with the following data:
Property | Description |
---|---|
data | Activity JSON |
Update an activity given its internal database ID. Data is the same than POST requests.
Get an activity given its internal database ID.
Get the activities matching with the request parameters as specified at the end of this document.
This API provides additional filters:
Parameter | Description |
---|---|
uiCombo | Advanced search (see UI field) |
activityId | As defined by the xAPI spec |
Count the activities matching with the request parameters as specified at the end of this document.
Delete an activity given its internal database ID.
Create an agent with the following data:
Property | Description |
---|---|
agent | Agent JSON |
pseudonymized | Is it a pseudonymized agent? |
person_id | ID of the person the agent refers to |
Update an agent given its internal database ID. Data is the same than POST requests.
Get an agent given its internal database ID.
Get the agents matching with the request parameters as specified at the end of this document.
This API provides additional filters:
Parameter | Description |
---|---|
uiCombo | Advanced search (see UI field) |
uiObjectType | Object type: Agent or Group |
uiName | Full or partial name |
agent | As defined by the xAPI spec |
Count the agents matching with the request parameters as specified at the end of this document.
Delete an agent given its internal database ID.
Delete the agents matching with the request parameters as specified at the end of this document.
Create an activity profile with the following data:
Property | Description |
---|---|
profile_id | ID of the profile as stated by xAPI (string) |
activity_id | ID of the activity as stated by xAPI (IRI) |
data | JSON object with 2 properties: type (MIME type) and content (data) |
Update an activity profile given its internal database ID. Data is the same than POST requests.
Get an activity profile given its internal database ID.
Get the activity profiles matching with the request parameters as specified at the end of this document.
This API provides additional filters:
Parameter | Description |
---|---|
uiActivity | Full or partial activity ID |
uiProfile | Full or partial profile ID |
profileId | As defined by the xAPI spec |
activityId | As defined by the xAPI spec |
since | As defined by the xAPI spec |
Count the activity profiles matching with the request parameters as specified at the end of this document.
Delete an activity profile given its internal database ID.
Create an agent profile with the following data:
Property | Description |
---|---|
profile_id | ID of the profile as stated by xAPI (string) |
agent | Agent JSON |
data | JSON object with 2 properties: type (MIME type) and content (data) |
Update an agent profile given its internal database ID. Data is the same than POST requests.
Get an agent profile given its internal database ID.
Get the agent profiles matching with the request parameters as specified at the end of this document.
This API provides additional filters:
Parameter | Description |
---|---|
uiAgent | Advanced search on agent (see UI field) |
uiProfile | Full or partial profile ID |
profileId | As defined by the xAPI spec |
agent | As defined by the xAPI spec |
since | As defined by the xAPI spec |
Count the agent profiles matching with the request parameters as specified at the end of this document.
Delete an agent profile given its internal database ID.
Create a state with the following data:
Property | Description |
---|---|
state_id | ID of the state as stated by xAPI (string) |
activity_id | ID of the activity as stated by xAPI (IRI) |
agent | Agent JSON |
registration | Registration as stated by xAPI (UUID) |
data | JSON object with 2 properties: type (MIME type) and content (data) |
Update a state given its internal database ID. Data is the same than POST requests.
Get a state given its internal database ID.
Get the states matching with the request parameters as specified at the end of this document.
This API provides additional filters:
Parameter | Description |
---|---|
uiAgent | Advanced search on agent (see UI field) |
uiActivity | Full or partial activity ID |
uiState | Full or partial state ID |
stateId | As defined by the xAPI spec |
activityId | As defined by the xAPI spec |
agent | As defined by the xAPI spec |
since | As defined by the xAPI spec |
Count the states matching with the request parameters as specified at the end of this document.
Delete a state given its internal database ID.
Get an attachment given its internal database ID.
Get the attachments matching with the request parameters as specified at the end of this document.
Count the attachments matching with the request parameters as specified at the end of this document.
Delete an attachment given its internal database ID.
Create a person with the following data:
Property | Description |
---|---|
owner_id | ID of the owner (i.e. the store) the data belongs to |
Update a person given its internal database ID. Data is the same than POST requests.
Get a person given its internal database ID.
Get the persons matching with the request parameters as specified at the end of this document.
Count the persons matching with the request parameters as specified at the end of this document.
Delete a person given its internal database ID.
Create a verb with the following data:
Property | Description |
---|---|
iri | Verb id as stated by xAPI (IRI) |
Update a verb given its internal database ID. Data is the same than POST requests.
Get a verb given its internal database ID.
Get the verbs matching with the request parameters as specified at the end of this document.
This API provides additional filters:
Parameter | Description |
---|---|
uiCombo | Advanced search (see UI field) |
Count the verbs matching with the request parameters as specified at the end of this document.
Delete a verb given its internal database ID.
Create an activity type with the following data:
Property | Description |
---|---|
iri | Activity type id as stated by xAPI (IRI) |
Update an activity type given its internal database ID. Data is the same than POST requests.
Get an activity type given its internal database ID.
Get the activity types matching with the request parameters as specified at the end of this document.
This API provides additional filters:
Parameter | Description |
---|---|
uiCombo | Advanced search (see UI field) |
Count the activity types matching with the request parameters as specified at the end of this document.
Delete an activity type given its internal database ID.
Create a statement category with the following data:
Property | Description |
---|---|
iri | Statement category id as stated by xAPI (IRI) |
profile | Is this category identified as an xAPI profile? |
Update a statement category given its internal database ID. Data is the same than POST requests.
Get a statement category given its internal database ID.
Get the statement categories matching with the request parameters as specified at the end of this document.
This API provides additional filters:
Parameter | Description |
---|---|
uiCombo | Advanced search (see UI field) |
Count the statement categories matching with the request parameters as specified at the end of this document.
Delete a statement category given its internal database ID.
Delete a store and all its data.
Remove all the xAPI data from a store.
Remove the statements from a store.
In order to improve the readability of this chapter, we illustrate the use of HTTP parameters in a Javascript way, as most Javascript HTTP clients would do (e.g. Axios).
This parameter takes an array of property names from the requested model. By default, sorting is ascending. Adding the minus sign makes it descending.
{
sort: ["id"] // Sort by the id, ascending
}
{
sort: ["-id"] // Sort by the id, descending
}
This parameter takes an integer which is the number of returned items.
{
limit: 10 // Don't return more than 10 items
}
This parameter takes an integer which is the number of items to skip.
{
skip: 3000 // Don't return the 3000 first items
}
This parameter takes an object which identifies the starting item. Only items after the starting item are returned, in the ascending order.
{
after: {id: 200} // Return items after ID 200 in the ascending order
}
This parameter takes an object which identifies the starting item. Only items before the starting item are returned, in the descending order.
{
before: {id: 400} // Return items before ID 400 in the descending order
}
This parameter takes an object defining options for a given request. Options are specific to each API.
{
options: {reveal: true} // Reveal the returned statements if they were pseudonymized
}
This parameter takes an object of filters to be applied.
Filtering on model properties
{
filters: {voided: true} // Return only the voided statements
}
Filtering on a JSON property
{
filters: {"data->version": "1.0.0"} // Return only statements with version 1.0.0
}
Comparison operators
{
filters: {"data->version": {$gte: "1.0.0"} // Return only statements with version from 1.0.0
}
Operator | Description |
---|---|
$eq | Equal |
$gt | Greater than |
$gte | Greater than or equal |
$lt | Less than |
$lte | Less than or equal |
$ne | Not equal |
$in | In array |
$nin | Not in array |
$text | Textual search |
$exists | Exists and not null |
Logical operators
{
filters: {voided: true, "data->version": "1.0.0"} // Implicit AND condition
}
{
filters: {$and: {voided: true, "data->version": "1.0.0"}} // Explicit AND condition
}
{
filters: {$or: {voided: true, "data->version": "1.0.0"}} // Explicit OR condition
}
JSON contains operator
Use [*]
to search a value in a JSON array.
{
filters: {"meta->hobbies[*]": "photo"} // Return items with "photo" in their hobbies
}
{
filters: {"meta->children[*]->name": "john"} // Return items with a child named "john"
}
{
filters: {"meta->children[*]": {"name": "john", "age": 10}} // Return items with a 10 years old child named "john"
}
JSON search operator
Use [*]
together with the $text
operator.
{
filters: {"meta->children[*]->name": {$text: "jo"}} // Return items with a child name containing "jo"
}