ContentAPI Usage and Documentation

Content API Documentation

The Content API is provided to enable you to extend dominKnow | ONE capabilities. Using the Content API your team can enable content developed outside dominKnow | ONE (loaded as HTML widgets) to interact with the dominKnow | ONE player, controlling player functionality (e.g., enabling next button, exit, get course language and more) and get and set variable data within the dominKnow | ONE course.

The API uses JavaScript calls to perform the various functions. 

For available options, review the API documentation.

When utilizing the content API syntax is key

With dominKnow | ONE you can access a variety of functions through the contentAPI and utilize them in your HTML widgets. When using them them, syntax is key.

The basic format can be seen below:

For getting and setting variables

//Where thevariablename is the name of a custom variable declared in your dominKnow | ONE project.
parent.contentApi.getData('thevariablename');

//Where tempVar is a JavasScript value to which you are setting the dominKnow | ONE variable.
parent.contentApi.setData('thevariablename',tempVar);


Calling a contentAPI action that gets the studentID

//Where studentID is the name of a custom variable declared in your dominKnow | ONE project.
var studentID = parent.contentApi.getUserID ();

Calling a contentAPI action that gets the studentName

//Where studentName is the name of a custom variable declared in your dominKnow | ONE project.
var studentName = parent.contentApi.getStudentName ();


//NOTE: If you are calling functions from the Execute JavaScript panel you are "one" frame above an HTML widget so the syntax would be:

contentApi.getData('thevariablename');

//instead of 

parent.contentApi.getData('thevariablename');

//drop the "parent" from the call.

General JavaScript Hints

It's often useful to see what is going on in a script. You can send information to the Browser's log (which you can see in advanced settings - JavaScript Console) so you know if the script is working.

For example in the studentName case you could report the value to the console log when testing with the following JavaScript command.

console.log ("student is " + studentName);

DISCLAIMER: The dominKnow support team does NOT provide programming/coding support for the creation of CSS and JavaScript elements when creating your dominKnow | ONE content.