quizzes

Interface to quiz related API calls
Description:
  • Interface to quiz related API calls
Source:
Returns:
Type
object

Methods

(inner) getQuizAllQuestions(quizId, parameters, networkParametersopt) → {Promise}

Description:
  • Retrieve all questions for a particular quiz from Constructor.io API
Source:
Example
constructorio.quizzes.getQuizAllQuestions('quizId', {
   quizVersionId: '123',
});
Parameters:
Name Type Attributes Description
quizId string The identifier of the quiz
parameters object Additional parameters
Properties
Name Type Attributes Description
section string <optional>
Product catalog section
quizVersionId string <optional>
Version identifier for the quiz. Version ID will be returned with the first request and it should be passed with subsequent requests. More information can be found: https://docs.constructor.com/reference/configuration-quizzes
quizSessionId string <optional>
Session identifier for the quiz. Session ID will be returned with the first request or with getQuizResultsConfig and it should be passed with subsequent requests. More information can be found: https://docs.constructor.com/reference/configuration-quizzes
networkParameters object <optional>
Parameters relevant to the network request
Properties
Name Type Attributes Description
timeout number <optional>
Request timeout (in milliseconds)
Returns:
Type
Promise

(inner) getQuizNextQuestion(quizId, parametersopt, networkParametersopt) → {Promise}

Description:
  • Retrieve next question from Constructor.io API
Source:
See:
Example
constructorio.quizzes.getQuizNextQuestion('quizId', {
   answers: [[1,2],[1]],
   section: '123',
   quizVersionId: '123',
   quizSessionId: '1234',
});
Parameters:
Name Type Attributes Description
quizId string The identifier of the quiz
parameters string <optional>
Additional parameters to refine result set
Properties
Name Type Attributes Description
section string <optional>
Product catalog section
answers array <optional>
An array of answers in the format [[1,2], [1], ["true"], ["seen"], [""]]. Based on the question type, answers should either be an integer, "true"/"false", "seen" or an empty string ("") if skipped
quizVersionId string <optional>
Version identifier for the quiz. Version ID will be returned with the first request and it should be passed with subsequent requests. More information can be found: https://docs.constructor.com/reference/configuration-quizzes
quizSessionId string <optional>
Session identifier for the quiz. Session ID will be returned with the first request and it should be passed with subsequent requests. More information can be found: https://docs.constructor.com/reference/configuration-quizzes
skipTracking boolean <optional>
If true, tracking for this question will be skipped. This is useful for preloading the first question of a quiz
networkParameters object <optional>
Parameters relevant to the network request
Properties
Name Type Attributes Description
timeout number <optional>
Request timeout (in milliseconds)
Returns:
Type
Promise

(inner) getQuizResults(quizId, parameters, networkParametersopt) → {Promise}

Description:
  • Retrieve quiz recommendation and filter expression from Constructor.io API
Source:
See:
Example
constructorio.quizzes.getQuizResults('quizId', {
   answers: [[1,2],[1]],
   section: '123',
   quizVersionId: '123',
   quizSessionId: '234'
});
Parameters:
Name Type Attributes Description
quizId string The identifier of the quiz
parameters string Additional parameters to refine result set
Properties
Name Type Attributes Description
answers array An array of answers in the format [[1,2], [1], ["true"], ["seen"], [""]]. Based on the question type, answers should either be an integer, "true"/"false", "seen" or an empty string ("") if skipped
section string <optional>
Product catalog section
quizVersionId string <optional>
Version identifier for the quiz. Version ID will be returned with the first request and it should be passed with subsequent requests. More information can be found: https://docs.constructor.com/reference/configuration-quizzes
quizSessionId string <optional>
Session identifier for the quiz. Session ID will be returned with the first request and it should be passed with subsequent requests. More information can be found: https://docs.constructor.com/reference/configuration-quizzes
page number <optional>
The page number of the results
resultsPerPage number <optional>
The number of results per page to return
filters object <optional>
Key / value mapping (dictionary) of filters used to refine results
fmtOptions object <optional>
Key / value mapping (dictionary) of options used for result formatting
hiddenFields Array.<string> <optional>
Hidden metadata fields to return
networkParameters object <optional>
Parameters relevant to the network request
Properties
Name Type Attributes Description
timeout number <optional>
Request timeout (in milliseconds)
Returns:
Type
Promise

(inner) getQuizResultsConfig(quizId, parameters, networkParametersopt) → {Promise}

Description:
  • Retrieve quiz results page configuration from Constructor.io API
Source:
Example
constructorio.quizzes.getQuizResultsConfig('quizId', {
   quizVersionId: '123',
});
Parameters:
Name Type Attributes Description
quizId string The identifier of the quiz
parameters string Additional parameters
Properties
Name Type Attributes Description
section string <optional>
Product catalog section
quizVersionId string <optional>
Version identifier for the quiz. Version ID will be returned with the first request and it should be passed with subsequent requests. More information can be found: https://docs.constructor.com/reference/configuration-quizzes
networkParameters object <optional>
Parameters relevant to the network request
Properties
Name Type Attributes Description
timeout number <optional>
Request timeout (in milliseconds)
Returns:
Type
Promise