Search code examples
tin-can-apixapi

Getting xAPI statements from an xAPI package


I'm trying to get my head around the workings of an xAPI package authored in Rise which has been supplied to me so I can build a test PoC app.

I can see the functions built into the index.html page, and that things like progress and quiz scores are genrated, but where do I find the end-point for a LRS within the package?

I have incorporated the package into a test app I built, but rather than generate and send statements myself I would like use what comes as part of the package.

If I import and play the package in SCORM Cloud, I get generated statements returned.

The only thing I can see is an entry in the tincan.js file, this.recordStores=[] other than that I'm unsure where to go next, any suggestions?


Solution

  • Generally this kind of package implements a set of guidelines that were released with the 0.9 version of the specification (at the time named the Tin Can API and then later changed to xAPI). Those guidelines provide for a packaging and launch mechanism which is what Rise has implemented. The launch mechanism indicates that the endpoint and authentication credentials will be passed on the query string to the launched content where it can retrieve them. The TinCanJS library used by Rise implements functionality to digest the query string and set up objects, those you find in this.recordStores to communicate with the xAPI LRS identified in the query string parameters.

    You have two primary options,

    1. Get the query string parameters directly from the launch URL and process it yourself, potentially using the same global library objects (TinCan.LRS) already available to get an LRS object that you can then interact with as you see fit,
    2. Leverage the object already created for you via the this.recordStores list that is already prepared by the package itself

    There are pros/cons to both methods and they largely depend on your familiarity with JavaScript and how flexible you need/want to be.