# API Concepts
The summary provides a quick overview of current user's answers and selections. The summary is updated whenever a question answer had changed, user backtracks through a questionnaire using the navigation or reset buttons, or state modifying API is invoked.
The summary object is an array, with each entry representing a question answer.
PROPERTY | PURPOSE |
---|---|
questionId | Related question ID. |
questionSlug | Question's short code. |
questionDescription | Localized question description text. |
answerType | User's selection type. Can be one of 'text' or 'choice'. |
answerId | Answer ID if answer type was 'choice' |
answerValue | Answer value if answer type was 'text' |
answerSlug | Answer short code if answer type was 'choice' |
answerSlug | Answer short code if answer type was 'choice' |
answerDescription | Localized answer description text if answer type was 'choice' |
$(function () {
// Cartographer is now ready for use.
var recommender = new Drive.GuidedRecommender({
// Listen to the update event and modify the UI accordingly.
summaryUpdated: function (summary) {
summary.forEach(function (entry) {
// Do something with the summary entry.
console.log(entry.questionDescription, ':', entry.answerDescription);
});
}
});
// Alternatively use the API method to retrieve summary on demand:
var summary = recommender.summary();
});