Injected History
Below is a detailed look at injected history.
{
"traversalId": Guid,
"assetId": int,
"answerId": int,
"value": "string",
"injectedHistoryType": Enum,
"isAnswered": bool
}
TraversalId
: Your unique traversal Identifier. Nullable
AssetId
: Identifier of the asset, i.e. Question Id. Required
AnswerId
: Identifier of the Answer. Required
Value
: The value of answer. Only used for answers that were of type Text
, Date
, or Number
. Nullable
InjectedHistoryType
: An enum that takes either PreAnswer
or PrePopulate
.PreAnswer
tells the API to automatically answer the question so it will not be shown on the UI.
PrePopulate
returns the question to the UI, but the given answers will be already set. These answers are changable.
IsAnswered
: Tells us which answer of a question was selected. If the asnwer is of type Text
, Date
, or Number
you still need to set the isAnswered
to true
.
When starting a product like Online triage (aka Symptom Assessment) it is possible to push data into your traversal that could affect the questions and answers you see. Taking the example from the quickstart guide, if we wanted to skip the question asking who you're answering for, you would push the data for that question into your first API call.
The below call will now skip the first question, immediately moving to the second question.
curl ".../api/v1/{tenantId}/Traversals" \
-X "POST" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" -d '{
"shortCode": "XYZ",
"injectedHistory": [{
"assetId": 13045,
"answerId": 7527,
"injectedHistoryType": "PreAnswer",
"isAnswered": true
},
{
"assetId": 13045,
"answerId": 7528,
"injectedHistoryType": "PreAnswer",
"isAnswered": false
}]
}'
You could easily do this for any question in a product, assuming you knew all the pertinent Ids and values. But they do need to be injected at the start of a traversal, when it's created.