You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
close
You are viewing the article in preview mode. It is not live at the moment.
Extensions
print icon

Extensions

 

Extensions are a way to include additional information in a particular xAPI object that is not part of the standard properties of that object. For example,

 

  • If your module had a difficulty setting you could track which setting a user had chosen in a context extension.
  • In a javelin throwing simulation,  you might would want to track both distance thrown as well as an assigned point score. "Score" is already available in the result object, and you could track the distance thrown in a result extension.
  •  

Context, Object, and Result object can all support extensions. Regardless of which object type you are adding them to, they are handled in the same way. First, you create a new Extension object:

 

Extension sampleExtension = new Extension();

 

Then you can either use the add() or addSimple() functions to add as many key/value pairs to the Extension object as you want.

 

  • add(): The add() function requires the key to be an IRI, which conforms to the xAPI spec.
  • addSimple(): Apex does not enforce the requirement that an extension key be an IRI, and the addSimple() function allows you to use a simple string as your key.
  •  

Extension sampleExtension = new Extension();

sampleExtension.Add("https://www.pixovr.com/xapi/extensions/iri_extension","value");

sampleExtension.AddSimple("simple_key", "value"

 

Feedback
1 out of 1 found this helpful

scroll to top icon