• Register

TuGo API Forums


RSS Feed

Submitting Questionnaires

    • matt
    • Topic created 9 years ago

    I see that InsuredPerson includes a member variable 'questionnaires'. And I see the definition of the Questionnaire class. But I don't see an example of how to pass a completed questionnaire to your system.

    When I submit an answered questionnaire as part of a quote request or new policy request do I need to include all members of the Questionnaire class (ie. including the question content)? Or can I submit something like this:


    Or this, which is even cleaner:


    Message edited by matt 9 years ago

  1. Ken Lum9 years ago

    You only need to submit the question codes and, for each answer in your answer list, the answer code and value (as a float: -1.0, 0.0, or 1.0).

    However, for each question, you must submit a list of answers because there are some questionnaires in our system (perhaps not the ones you're currently working with) that have questions requiring more than one answer. Rather than supporting scalar and vector responses, we decided to only support vector responses for consistency.

  2. Clyde9 years ago


    Just to reiterate the sample json you provided in the first example is sufficient to get a quote or purchase a policy. The only thing that is missing is the value for each answer. Here is an updated sample json:

    {"code":"QU-FMQ","questions":[{"code":"QT-NOM-1","answers":[{"code":"q1a1", "value":1}]},{"code":"QT-2MS","answers":[{"code":"q2a1", "value":1}]},{"code":"QT-NOM","answers":[{"code":"q3a1","value":1}]},{"code":"QT-CMT","answers":[{"code":"q4a1","value":1}]},{"code":"QT-TU","answers":[{"code":"q5a1", "value":1}]}]}

    Notice in the response the plan's priceBreakdown the value of the HLTH factor will change depending on how the questionnaire was answered.

    Another thing to keep in mind that for each question there is a logicalExpression. This logical expression is used to determine if the current question needs to be answered based on how the previous questions were answered. It is perfectly fine to submit all questions but to save customers time and not ask too many unnecessary questions you may use the logicalExpression.

    Ex. logicalExpression: q1a3<=0 & q1a4<=0 (Answer question 2 if q1a3 is not selected and q1a4 is not selected).


[ Page 1 of 1 ]