Items API Methods
getItems()
Returns the JSON data for each Item of the Activity.
You would want to use this method so that you can inspect the content of the Items or retrieve a list of Item references in the current Activity, for example.
Examples
// Get the JSON data for all Items
var items = itemsApp.getItems();
console.log(items);
// Get a list of all Item references
var itemReferences = Object.keys(items);
console.log(itemReferences);
/* Example return object structure
{
'item_reference_1': { ... },
'item_reference_2': { ... },
'item_reference_3': { ... },
}
*/
// Return data example for rendering_type: "assess"
{
assess_item_reference: {
active: false,
attempt_status: true,
content: "<p>My Item content</p>",
feature_ids: [],
metadata: {
scoring_type: "per-question"
},
response_ids: [
"item_response_id_1"
],
source: {
organisation_id: 1,
reference: "assess_item_reference"
},
time: 317
user_flagged: false,
viewed: true
}
}
// Return data example for rendering_type: "inline"
{
inline_item_reference: {
content: "<p>My Item content</p>",
feature_ids: [],
metadata: {
scoring_type: "per-question"
},
reference: "inline_item_reference",
response_ids: [
"item_response_id_2"
],
source: {
organisation_id: 1,
reference: "inline_item_reference"
},
workflow: []
}
}
Arguments
None.
Return value
Type object
An object where each key is the Item reference and the values are the JSON data objects for each Item.
Related articles
- The
getQuestions()
method, the method used to get the JSON object data for all Questions in the assessment. - The
getFeatures()
method, the method used to get the JSON object data for all Features in the assessment.