Definition

GET - 3/surveys/{surveyId}/questions/{questionId}/result?lang={lang}&filter={filter}

Retrieve the reults in aggregate for a question by id or datalabel. Hint: If you're looking to get the individual answers to a survey, download the respondents.

Required roles: Results (read)
Response cached for 60

Request information

NameDescriptionTypeAdditional information
surveyId

The id of a survey.

integer

Required

questionId

The id or datalabel of a question.

string

Required

lang

The language in which you would like to retrieve the questions. If the requested language is not available we will use the default language from the survey. The available language code can be found for each survey in the Survey - Langs property.

string

Optional

filter

Select only the respondents that satisfy the predicate expression, only these respondents will be used to calculate the result. read more

string

Optional

Response information

Payload containing the total for each possible response of a question represented by its datalabel.


NameDescriptionTypeAdditional information
Meta

The metadata such as paging parameters, status code, timestamp,... which are related to this request.

MetaData

Data

The actual data returned by the request.

SurveyQuestionResult

Links

HATEOAS related to this object. It wil contain relevant url's such as previous and next page for paged results, create/update/delete action. These url's can be used in your application for the next steps in your application logic.

Hateoas

Sample:
{
  "Meta": {
    "Status": 1,
    "TotalRowCount": 1,
    "Limit": 1,
    "Offset": 1,
    "TotalPageCount": 1,
    "StartRec": 1,
    "StopRec": 1,
    "Timestamp": "2019-02-21T14:05:04.5336852Z",
    "IsFiltered": true
  },
  "Data": {
    "ResponseResults": [
      {
        "SurveyId": 1,
        "QuestionId": 2,
        "ResponseId": 3,
        "ResponseCount": 4
      },
      {
        "SurveyId": 1,
        "QuestionId": 2,
        "ResponseId": 3,
        "ResponseCount": 4
      }
    ],
    "ResponseAggregate": {
      "Date": "sample string 1",
      "ResponseCount": 2,
      "NPS": 3.1,
      "Median": 4.1,
      "Average": 5.1,
      "StandardDeviation": 6.1,
      "Sum": 7.1
    },
    "Id": 2,
    "DataLabel": "sample string 3",
    "Language": "sample string 4",
    "QuestionTypeId": 5,
    "Caption": "sample string 6",
    "Required": true,
    "DataTypeId": 8,
    "ScaleTypeId": 64,
    "Hidden": true,
    "MinValue": 1,
    "MaxValue": 1,
    "PageNumber": 9,
    "OrderNumber": 10,
    "QuestionNumber": 11,
    "ParentQuestionId": 12,
    "UseSentimentScore": true,
    "SubQuestions": [
      {
        "$id": "1",
        "Id": 1,
        "DataLabel": "sample string 2",
        "Language": "sample string 3",
        "QuestionTypeId": 4,
        "Caption": "sample string 5",
        "Required": true,
        "DataTypeId": 7,
        "ScaleTypeId": 64,
        "Hidden": true,
        "MinValue": 1,
        "MaxValue": 1,
        "PageNumber": 8,
        "OrderNumber": 9,
        "QuestionNumber": 10,
        "ParentQuestionId": 11,
        "UseSentimentScore": true,
        "SubQuestions": [
          {
            "$ref": "1"
          },
          {
            "$ref": "1"
          }
        ],
        "QuestionResponses": [
          {
            "ResponseId": 2,
            "Caption": "sample string 3",
            "Hidden": true,
            "Other": true,
            "NotApplicable": true,
            "Order": 1,
            "Value": 1.0,
            "ScaleValue": 1
          },
          {
            "ResponseId": 2,
            "Caption": "sample string 3",
            "Hidden": true,
            "Other": true,
            "NotApplicable": true,
            "Order": 1,
            "Value": 1.0,
            "ScaleValue": 1
          }
        ]
      },
      {
        "$ref": "1"
      }
    ],
    "QuestionResponses": [
      {
        "ResponseId": 2,
        "Caption": "sample string 3",
        "Hidden": true,
        "Other": true,
        "NotApplicable": true,
        "Order": 1,
        "Value": 1.0,
        "ScaleValue": 1
      },
      {
        "ResponseId": 2,
        "Caption": "sample string 3",
        "Hidden": true,
        "Other": true,
        "NotApplicable": true,
        "Order": 1,
        "Value": 1.0,
        "ScaleValue": 1
      }
    ]
  }
}
Sample:
<Payload xmlns:i="http://www.w3.org/2001/XMLSchema-instance" z:Id="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
  <Data z:Id="i2">
    <Caption>sample string 6</Caption>
    <DataLabel>sample string 3</DataLabel>
    <DataTypeId>8</DataTypeId>
    <Hidden>true</Hidden>
    <Id>2</Id>
    <Language>sample string 4</Language>
    <MaxValue>1</MaxValue>
    <MinValue>1</MinValue>
    <OrderNumber>10</OrderNumber>
    <PageNumber>9</PageNumber>
    <ParentQuestionId>12</ParentQuestionId>
    <QuestionNumber>11</QuestionNumber>
    <QuestionResponses>
      <SurveyQuestionResponse z:Id="i3">
        <Caption>sample string 3</Caption>
        <Hidden>true</Hidden>
        <NotApplicable>true</NotApplicable>
        <Order>1</Order>
        <Other>true</Other>
        <ResponseId>2</ResponseId>
        <ScaleValue>1</ScaleValue>
        <Value>1</Value>
      </SurveyQuestionResponse>
      <SurveyQuestionResponse z:Ref="i3" />
    </QuestionResponses>
    <QuestionTypeId>5</QuestionTypeId>
    <Required>true</Required>
    <ScaleTypeId>64</ScaleTypeId>
    <SubQuestions>
      <SurveyQuestion z:Id="i4">
        <Caption>sample string 5</Caption>
        <DataLabel>sample string 2</DataLabel>
        <DataTypeId>7</DataTypeId>
        <Hidden>true</Hidden>
        <Id>1</Id>
        <Language>sample string 3</Language>
        <MaxValue>1</MaxValue>
        <MinValue>1</MinValue>
        <OrderNumber>9</OrderNumber>
        <PageNumber>8</PageNumber>
        <ParentQuestionId>11</ParentQuestionId>
        <QuestionNumber>10</QuestionNumber>
        <QuestionResponses>
          <SurveyQuestionResponse z:Ref="i3" />
          <SurveyQuestionResponse z:Ref="i3" />
        </QuestionResponses>
        <QuestionTypeId>4</QuestionTypeId>
        <Required>true</Required>
        <ScaleTypeId>64</ScaleTypeId>
        <SubQuestions>
          <SurveyQuestion z:Ref="i4" />
          <SurveyQuestion z:Ref="i4" />
        </SubQuestions>
        <UseSentimentScore>true</UseSentimentScore>
      </SurveyQuestion>
      <SurveyQuestion z:Ref="i4" />
    </SubQuestions>
    <UseSentimentScore>true</UseSentimentScore>
    <ResponseAggregate z:Id="i5">
      <Average>5.1</Average>
      <Date>sample string 1</Date>
      <Median>4.1</Median>
      <NPS>3.1</NPS>
      <ResponseCount>2</ResponseCount>
      <StandardDeviation>6.1</StandardDeviation>
      <Sum>7.1</Sum>
    </ResponseAggregate>
    <ResponseResults>
      <SurveyResponseResult z:Id="i6">
        <QuestionId>2</QuestionId>
        <ResponseCount>4</ResponseCount>
        <ResponseId>3</ResponseId>
        <SurveyId>1</SurveyId>
      </SurveyResponseResult>
      <SurveyResponseResult z:Ref="i6" />
    </ResponseResults>
  </Data>
  <Meta>
    <IsFiltered>true</IsFiltered>
    <Limit>1</Limit>
    <Offset>1</Offset>
    <StartRec>1</StartRec>
    <Status>1</Status>
    <StopRec>1</StopRec>
    <Timestamp>2019-02-21T14:05:04.5336852+00:00</Timestamp>
    <TotalPageCount>1</TotalPageCount>
    <TotalRowCount>1</TotalRowCount>
  </Meta>
</Payload>

Related Examples

Title
Advanced querying