Skip to main content

Get a question by id

GET 

/surveys/sessions/:token/questions/:questionId

Get question or answered question by question id and survey token

Request

Path Parameters

    token stringrequired

    The token identifying this session

    questionId stringrequired

    The question for which the answer corresponds to

Responses

Get question or answered question by question id and survey token

Schema

    id stringrequired

    Id of this question

    sectorId stringrequired

    Possible values: [transport, lifestyle, diet, home, publicservices, intro, personal, summary]

    The id of this area, see Area

    title stringrequired

    The question to be answered

    question stringrequired

    The question posed to the user

    previousQuestionId string

    Id of previous question in order to navigate back and change previous question

    nextQuestionId string

    Holds the id of the next question to be answered can be fetched with the /surveys/sessions/:token/questions/:id endpoint

    nextSection string

    If populated this section

    multiQuestion boolean

    If multiQuestion is true then the answers array will contain multiple questions and answers for the users to respond to Example:

     Q: How many flights have you taken in these categories
    A[0]: 0-4h
    A[1]: 5-8h
    A[2]: 8-12h
    A[3]: More than 12h

    answers

    object[]

    required

    A set of Answers for this question. If present this denotes the valid answers for this Question Example: Q: Which country do you live in? Options: [Albania, Argentina, Aruba, etc...]

  • Array [

  • title string

    Title to display for the user

    clarification

    object

    title stringrequired
    body stringrequired

    options

    object[]

    Options for the user to Answer if applicable

  • Array [

  • id stringrequired

    Id of the question

    requiresInput booleanrequired

    true if this option needs input from the user or not

    type stringrequired

    Possible values: [input, range, boolean, list, button, search]

    input, range, boolean

    option stringrequired

    The option

    clarification

    object

    title stringrequired
    body stringrequired
    unit string

    Possible values: [km, m, liter, m2, m3, mi., ft., gal., ft2, kWh, hours, minutes, days, weeks, months, percent, currency]

    km, m, litre, m3, m2, minutes, percent

    isUserAnswer boolean

    True if the user chose this option as answer

    validationExpression string

    Javascript based regular expression to validate user input

    input string

    If @requiresInput is true then answer from user is stored here Otherwise its already populated

    rangeMin double

    If the value should be entered as a range between rangeMin and rangeMax this will be populated with the minimum value for the range

    rangeMax double

    If the value should be entered as a range between rangeMin and rangeMax this will be populated with the maximum value for the range

    rangeStep double

    In a range scenario this denotes the step range should step up by

    autoCompletePath string

    If this option supports autofill, a GET request can be made to this endpoint in order to get matching options

  • ]

  • ]

  • hasNextQuestion booleanrequired

    Indicates if there are more questions in the survey. If false then this is the las question in the survey

    meta

    object

    required

    Session and meta information used by the server. Should be sent with every request to server

    percentage doublerequired

    Percentage of the questionnaire that is already answered

    totalEmissions doublerequired

    Sum of all emissions up until now

    sectors

    object[]

    required

    Distribution of emissions per sector

  • Array [

  • emissions doublerequired
    id stringrequired

    Possible values: [transport, lifestyle, diet, home, publicservices, intro, personal, summary]

    name stringrequired

    sectorDetails

    object[]

    required

  • Array [

  • emissions doublerequired
    id stringrequired
    name stringrequired
  • ]

  • progress

    object

    Represents the current progress in a certain area:

    example:

    {
    name: 'transport', // Area
    count: 10, // Number of answered questions
    total: 20, // Total number of question in area
    progress: 0.5 // 50% answered
    }
    name stringrequired

    Name of the area

    count int32required

    No of answered questions in area

    total int32required

    Total number of questions in area

    progress doublerequired

    Progress percentage

  • ]

  • numberOfQuestions int32required

    Total number of questions

    currentQuestionIndex int32required

    Index of current question

Loading...