Product and Questions
If you are letting partners connect to your API, you will need to provide them with the line ID to use. This can be found in the Copilot when you are editing a line.
On the flip side, if you are connecting to an API (for example, to get a quote you will need to make sure that you have the line ID from your partner before you can use these API's to quote a line).
Line & Question Payload
POST: https://api.{ENV}.dais.com/ioi/v3/product/{productId}/questions
curl --location --request POST 'https://api.{ENV}.dais.com/ioi/v3/product/<productId>/questions' \ --header 'Authorization: Basic <yourAuthHere>' \ --header 'Content-Type: application/json' \ --data-raw '{ "skipLineQuestions": [ "<productId>" ], "excludeQuestions": <boolean> }'
{ "skipLineQuestions": [ "217ff300-a200-4a19-a483-b56038634c2c" ], "excludeQuestions": false }
Request fields:
Property | Required | Description |
---|---|---|
skipLineQuestions | false | Array of productIds to exclude from the response |
excludeQuestions | false | Boolean field for excluding questions from the response. The response will contain an empty lines array when this is set to true . |
You can find the
line_id
in CoPilot, under "Programs" > "Lines / Forms" and selecting a line you are interested in. Line Id is shown at the bottom next to the Last Updated timestamp.
Line question response body responds in a tree view organized in a structure Section > Subsection > Questions - for however many sections, subsections and questions there are.
{ "lineId": "f0ebf95d-6dc8-4aab-a1fa-e39197540e10", "lineName": "Product Name", "generatesQuotes": true, "supportedEvents": { "4338b0c2-9dd6-4d03-b467-81e4ba16c1f7": [ "GET_QUOTES", "POLICY_CREATED" ] }, "toc": [ { "lineId": "96fe6afb-3112-47cf-902a-459bb8052e63", "lineName": "Product Name", "prefillEnabled": false, "active": true, "toc": [ { "lineId": "f74fad6e-b059-4e2b-b63f-04fcb1d212e4", "lineName": "Question set 1", "prefillEnabled": false, "active": true, "toc": [] }, { "lineId": "15fbbcc1-a22d-4023-bfb5-83c6faf235ac", "lineName": "Question set 2", "prefillEnabled": false, "active": true, "toc": [] } ] } ], "product": [ { "id": "690d6a90-d35c-4955-9582-18c9b3d68bd2", "active": true, "title": "Product Name", "clientType": "COMMERCIAL", "type": "CUSTOM", "lines": [ { "id": "f74fad6e-a059-4e2b-b63f-04fcb1d314e4", "active": true, "title": "Question set 1", "clientType": "COMMERCIAL", "type": "LINE_FRAGMENT", "ocrId": "", "display": { "sections": [ { "title": "section title", "subsections": [ { "title": "Sub Section", "questions": [ // question list ] } ] } ], "defaultAnswers": {} }, "lines": [], "template": false } ], "template": false } ] }
Each question object is designed around 3 major parts:
1. Question Definition:
Identifiers, question text, type, loop definition
2. Answer Definition:
What type of answer is expected, and how its derived. For example, is it a TEXT, PHONE or SELECT, etc.
If multi-choice, this section defines choices.
3. Condition:
Rules that determine if the question should be presented to the user.
This is a sample payload of a single question:
{ "qid": "q-6f6bac7b-8bf4-4474-8ad1-d5cd7f269659", "lineId": "690d6a90-d35c-4955-9582-18c9b3d68bd2", "question": "question text", "required": true, "visible": true, "ruleQuestion": false, "preAnswered": false, "order": 1, "max": 0, "min": 0, "loopDefinition": { "by": "QUESTION_IDENTIFIER", "identifier": "string" }, "loopQuestions": [ // optional list of additional questions ], "answerType": "PHONE", "answerChoices": [ { "choiceValue": "string", "label": "string", "order": 0, "prefix": "string", "suggestion": "string" } ], "condition": { "data": [ { "key": "string", "loop": true, "type": "STRING" } ], "fn": [ null ], "operation": "AND|EQUAL|OR" } }
Basic Question Properties
qid
: Question ID - this identifier must be unique per question within the application. Read more on QID Reuserequired
: Boolean flag to indicate if answer to the question is requiredanswerType
: Type of answer expected. Refer to the Answer Types table for more informationdefaultAnswer
: If the question has a default answer, it will be defined here.max
&min
: If the answer has to stay within certain numerical bounds, the range is defined bymin
...max
Question Loop Properties
A question structure supports question nesting. The primary purpose is the ability to create looping questions. For example, we could ask "How many homes do you have", and if the answer is greater than 1, then we might want to ask an address for each home.
loopQuestions
: Contains an array of questions that will be looped.loopDefinition
: Lets you specify how you want to terminate the loop (how many times to iterate)identifier
: Ifby
isQUESTION_IDENTIFIER
, then this field has to be defined.by
:QUESTION_IDENTIFIER
: Loop length is indicated by a value of an answer to a question with thisQID
USER_TERMINATED
: After each loop, a user can "Add another ..."
Question Conditions
The main function of a condition is to comparatively evaluate two sides. The evaluation may result in either a true
or false
conclusion. If it evaluates to true
, then the condition has been met, otherwise condition has failed.
Therefore, the first element to decide on a condition is the operation
by which to compare two sides:
operation
: may be defined asAND
,EQUAL
, orOR
.- Sides of the evaluation may be defined as two expressions, or as other conditions. For example:
10 EQUAL 10
- here I am evaluating if 10 equals 10true EQUAL (10 EQUAL 10)
- in this example, I can evaluate if a left side10
, will equal the right side.
However, the right side first needs to evaluate in order for the first comparison to be made.
This is afunctional expression evaluation
that allows for embedding of conditional logic.
data
: Specifies a side that is not another condition, but rather some data obtained.data
Accepts a list of objects that will be evaluated among themselves by theoperation
. It contains following attributes:type
:STRING
orNUMBER
orQUESTION_IDENTIFIER
key
: value portionloop
: Boolean to indicate if this condition refers to a condition of a question inside a loop.
fn
: List of other conditions that will be comparatively evaluated by theoperation
.
Answer Types
The primary purpose for variety of answer types is to simplify and explain the input options to the user. They either enforce the format of data, or limit
Type | Description |
---|---|
TEXT | Basic text input type. |
BOOLEAN | Evaluates to either YES or NO . |
CHECKBOX | Checkbox input type. Using answerType , specify any number of label/value pairs you need. min value may optionally be specified to limit the number of allowed checks. |
SELECT | Select input. With this type of question type, answerType has to be specified as well. |
NUMBER | Any number format. |
CURRENCY | Same as number, but the presentation shows a $ prefix. |
PHONE | Value returned for this data type contains only digits. |
DATE | Calendar selector that returns data format in ISO8601 UTC format. |
ZIP | 5-digit zip code. |
FEIN | Enforces FEIN format XX-XXXXXXX . |
YEAR | 4-digit year. |
STATE | Two uppercase letter state code. |
SQ_FEET | Same as number, but prefixed with the sqf on input. |
PERCENT | Same as number, but prefixed with the % on input. |
RATE_CLASS |
QID Reuse
Each question defined is assigned a Question Identifier (QID). For convenience of entering questions, if you do not supply a qid, one is automatically created for a new question at the time it is saved in CoPilot.
Consider the case of 2 lines.
- Let's say that Line-1 asks a questions "How old are you?".
- Let's say that Line-2 asks a slightly different question - "How many years have passed since you were born?".
Both questions, in this case, ask for same information. The only difference is in the way the question is asked. Ideally, we would like the behavior where if a question is answered in Line-1, that its answer is reused for answering the question in Line-2.
The way this is achieved is though QID Reuse.