stateproperty, and how it is used. State controls the startup modes of the API, to allow for different behaviors during an assessment.
state will determine the mode that the API should use to initialize.
Based on its value, you will be able to start/preview a new Activity, or continue/review an existing Activity.
It is not always necessary to define a state, because the API will intelligently choose a state for you based on the session id.
If you want to specify a state for Items API, there are two possible values:
"initial"state is set when an assessment is loaded without any existing session associated. This is applied automatically and is not required to be manually set at initialization. Once the assessment is commenced and a session is created, any reload of the assessment will be assigned one of the other three states either automatically or manually set in the initialisation.
"preview"state will display the items in their initial (pre user interaction) or resumed state however will lock any interaction with the item. This state is used if there is need to display the items to the user but block them from answering the questions.
"resume"state is set when an assessment is loaded and there is an existing session associated with the assessment. This can be after a pause or a save/close event has been enacted and the assessment then restarted or reopened. This is applied automatically and is not required to be manually set at initialization.
"review"state is used to display the item validation, showing correct and incorrect values for responses and if set, the correct answers for incorrect responses. Review state will also display distractor rationale if enabled.
When initialising Items API, the
state does not need to be set. Internally, the API will check whether a session exists for a given
session_id, then do one of the following:
- If an existing session is found the assessment will be initialized in "resume" mode.
- If no existing session is found, a new assessment will be created (in "initial" mode).
However, if you want to initialise an assessment in review or preview mode, the
state needs to be set using either
"preview" as required.