xAPI
MOTAR exposes a simple xAPI endpoint for capturing user metrics.
xAPI v2 meets the latest xAPI specification.
xAPI v2
Create a Statement
POST
https://api.motar.io/edu/v2/xapi/statement
This API route creates an xAPI-spec compliant statement.
Headers
Name | Type | Description |
---|---|---|
Authorization* | String | Auth token generated by login. |
Request Body
Name | Type | Description |
---|---|---|
actor* | Object | Statement actor definition. |
verb* | Object | Statement verb definition. |
object* | Object | Statement object definition. |
result | Object | Optional statement result definition. |
context | Object | Optional statement context definition. |
timestamp | String | Optional statement timestamp. |
authority | Object | Optional statement authority. |
Example Statements
xAPI statements in MOTAR follow the xAPI specifications and guidelines. You can use statements to record your own events in your experiences.
Recording Student Lesson Activity
Other than the standard xAPI structure, there are a few things to highlight in this example:
An account
definition in the actor
is required. The account
must:
include a
homePage
of "https://motar.io"include the actor's MOTAR account name in the
name
field.
A verb
ID must be from the xAPI library, located here. If your implementation requires additional verbs, please contact us and we can add your custom verbs to our allowed list.
An object
definition must include the object's MOTAR API ID in its extensions
definition. This is how MOTAR links your statement to the object internally. The object's id
parameter can be a MOTAR URI or a URI linking the object to your system, if desired.
To make sure your statement is properly linked in MOTAR, you may include any additional IDs that are not directly part of the object
definition in the extensions
section of the context
definition.
These can include:
Student ID
Class (Education Class) ID
User ID
Lesson ID
Course ID
Lesson Result
Recording Student Course Activity
Recording Student Badge Activity
MOTAR xAPI URI Definitions
Objects
These URIs must be used in the id
field of the object
definition. You do not need to match the name or description of the object in your statement, these are arbitrary.
Course:
https://dynepicdx.com/xapi/objects/course
Lesson:
https://dynepicdx.com/xapi/objects/lesson
Lesson Result:
https://dynepicdx.com/xapi/objects/lesson-result
Objective:
https://dynepicdx.com/xapi/objects/objective
Badge:
https://dynepicdx.com/xapi/objects/badge
Student:
https://dynepicdx.com/xapi/objects/student
Class (Education Class):
https://dynepicdx.com/xapi/objects/education-class
User:
https://dynepicdx.com/xapi/objects/user
Verbs
A complete list of verbs can be found here.
Extension ID URIs
Use the extensions
definition in either the context
or object
definition to add additional MOTAR API IDs. Although optional, adding these IDs is strongly recommended to ensure your statement is linked properly by the MOTAR API. These ID URIs are listed below.
Course ID:
https://www.dynepicdx.com/xapi/api-id/course
Lesson ID:
https://www.dynepicdx.com/xapi/api-id/lesson
Lesson Result ID:
https://www.dynepicdx.com/xapi/api-id/lesson-result
Objective ID:
https://www.dynepicdx.com/xapi/api-id/objective
Badge ID:
https://www.dynepicdx.com/xapi/api-id/badge
Student:
https://www.dynepicdx.com/xapi/api-id/student
Class (Education Class):
https://www.dynepicdx.com/xapi/api-id/education-class
User:
https://www.dynepicdx.com/xapi/api-id/user
xAPI v1
Create Statement
POST
https://api.motar.io/edu/v1/xapi/statement
This endpoint creates an xAPI statement. See below for special keys needed for indexing your metrics.
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Auth token generated by login. |
Request Body
Name | Type | Description |
---|---|---|
timestamp | string | A parseable ISO date (eg. 2020-01-07T21:45:35.649Z). |
actor | string | User ID of the actor performing the action. |
verb | string | Action that the actor is carrying out on the object. |
object | object | Target of the action the user is carrying out. This is expected to be a JSON object (stringified or raw). |
Object: There are a few keys you can attach to your object to ensure your statement is indexed to other MOTAR objects:
lessonId: this statement is part of a specific lesson. This is required for the statement to appear in a student's results in MOTAR.
classId: this statement happened in a specific class.
studentId: this statement was the action of a specific student in a class. If not provided, the API will attempt to guess the student ID as follows: take the user making the statement and take their newest class that is taking the lesson indicated by a provided lesson ID.
lessonResultId: this statement is part of a specific lesson result.
objectiveId: this statement is related to a specific course objective.
Object: Additionally, you can add certain flags to your object that will be respected and highlighted by the MOTAR Dashboard and/or other systems:
questionText: if the xAPI statement is about a certain question, you can include the question's text to index the statement to the relevant question. You must also include a lessonId for this indexing to be successful.
questionIndex: alternative to questionText, this accomplishes the same indexing but uses the array index of the question rather than the text.
error: indicates the statement is an error by the student.
assist: indicates an assist to the student.
safety: indicates a safety by the student.
knowledge: indicates a skill or piece of knowledge the student has demonstrated.
target: free text indicating an object that is not covered by the above IDs. For example, you can send in "Tool Control" to indicate the verb applies to a specific skill in your application.
Verb: If possible, re-use verbs to group statements together. For example, you can use the preset verb "Correct Item Selected" when the user picks up the correct tool in a simulation.
Other preset verbs:
Perfect Sequence: indicates a user aced a lesson sequence.
Incorrect Item Selected: opposite of "Correct Item Selected"
Repeated Steps: indicates a user repeated the steps in a module one or more times.
xAPI Used in Event Set module
MOTAR Event Set modules use xAPI. See here for more details on how to use xAPI statements to record user activity in a lesson.
Example Statements
Below are a few examples of how to create data-rich xAPI statements in MOTAR. Under each is a representation of how that statement will appear to MOTAR users. Note that the "verb" text is arbitrary and should be tailored to your application's actions, but re-using verbs throughout your application is highly recommended.
A student correctly picked up a tool in a VR simulation:
A student made a safety error:
A student required their first prompt (assist) to carry out a task:
A student learned knowledge from an NPC:
Last updated