Questions API

API Description

In order to use the API you must have the valid environment-specific username and password. Before any API requests, you need to obtain an API KEY. You will get a valid API KEY by using the VoC authentication API

The API KEY must be sent in the request authorization header element. If the API KEY value is valid then API request will be successful (http status code 200), otherwise it will fail (http status code 401). All API requests must be made over HTTPS.

API Endpoints

EnvironmentEndpoint
Productionhttps://api.confidently.fi/api/responses/prod/v2/company/survey/{surveyId}
Testhttps://api.confidently.fi/api/responses/test/v2/company/survey/{surveyId}

API request parameters

ParameterDescription
surveyIdThe unique id of the survey

API response

ElementDescriptionType
surveyIdThe survey unique idlong
surveyNameName of the surveystring
questionsAll questions under the surveyarray
questionIdThe question unique idlong
questionTextThe questionstring
questionTypeThe current type of the question. Available options: 0 = multi choice, 1 = free text, 3 = No average or NPS, 10 = Only a report title, 11 = Highlight a report titleint
npsQuestionAvailable options: 0 = no, 1 = yesint
yesnoQuestionAvailable options: 0 = no, 1 = yesint
answerOrderAvailable options: 1 = Ascending order, 2 = Descending order, -1 = Sequence is not knownint
answerOptionsAll options under the questionarray
answerOptionUniqueIdThe answer option unique idlong
answerDescriptionThe answer optionstring
answerRawValue0 - N, where N is the number of answerOptions and corresponds to the answer in databaselong
answerTypeAvailable options: 0 = normal, 1 = not used in aggregate countingint

API request and response example

curl -X GET "https://api.confidently.fi/api/responses/test/v2/survey/3974" -H "Authorization: x-api-key {APIKEY}"

Successful API request returns results in JSON format.

{
  "surveyId": 3974,
  "surveyName": "VoC SMS Survey Demo",
  "questions": [
    {
      "questionId": 10985,
      "questionText": "How likely are you to recommend our service based on your experience this time? (10=extremely likely and 0=very unlikely)",
      "questionType": 0,
      "npsQuestion": 1,
      "yesnoQuestion": 0,
      "answerOrder": 1,
      "answerOptions": [
        {
          "answerOptionUniqueId": 32035,
          "answerDescription": "0",
          "answerRawValue": 0,
          "answerType": 0
        },
        {
          "answerOptionUniqueId": 32036,
          "answerDescription": "1",
          "answerRawValue": 1,
          "answerType": 0
        },
        {
          "answerOptionUniqueId": 32037,
          "answerDescription": "2",
          "answerRawValue": 2,
          "answerType": 0
        },
        {
          "answerOptionUniqueId": 32038,
          "answerDescription": "3",
          "answerRawValue": 3,
          "answerType": 0
        },
        {
          "answerOptionUniqueId": 32039,
          "answerDescription": "4",
          "answerRawValue": 4,
          "answerType": 0
        },
        {
          "answerOptionUniqueId": 32040,
          "answerDescription": "5",
          "answerRawValue": 5,
          "answerType": 0
        },
        {
          "answerOptionUniqueId": 32041,
          "answerDescription": "6",
          "answerRawValue": 6,
          "answerType": 0
        },
        {
          "answerOptionUniqueId": 32042,
          "answerDescription": "7",
          "answerRawValue": 7,
          "answerType": 0
        },
        {
          "answerOptionUniqueId": 32043,
          "answerDescription": "8",
          "answerRawValue": 8,
          "answerType": 0
        },
        {
          "answerOptionUniqueId": 32044,
          "answerDescription": "9",
          "answerRawValue": 9,
          "answerType": 0
        },
        {
          "answerOptionUniqueId": 32045,
          "answerDescription": "10",
          "answerRawValue": 10,
          "answerType": 0
        }
      ]
    },
    {
      "questionId": 10986,
      "questionText": "Did you get your matter in order with one phone call?",
      "questionType": 0,
      "npsQuestion": 0,
      "yesnoQuestion": 1,
      "answerOrder": 2,
      "answerOptions": [
        {
          "answerOptionUniqueId": 32046,
          "answerDescription": "Yes",
          "answerRawValue": 0,
          "answerType": 0
        },
        {
          "answerOptionUniqueId": 32047,
          "answerDescription": "No",
          "answerRawValue": 1,
          "answerType": 0
        }
      ]
    },
    {
      "questionId": 10987,
      "questionText": "Open feedback",
      "questionType": 1,
      "npsQuestion": 0,
      "yesnoQuestion": 0,
      "answerOrder": -1
    }
  ]
}
Käytämme verkkosivustolla välttämättömiä evästeitä sivuston toiminnan parantamiseen.