Answers 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/{surveyId}/answers
Testhttps://api.confidently.fi/api/responses/test/v2/{surveyId}/answers

Note: Test environment can print max 10 answerGroup

API request header

HeaderValue
Authorizationx-api-key APIKEY

API request parameters

ParameterDescriptionMandatory
surveyIdThe unique id of the surveyX
startDateAnswers from dateX
endDateAnswers until date (default max 7 days difference)
detailsShow additionals (answerValues)

API response

ElementDescriptionType
surveyIdThe survey unique idlong
surveyNameName of the surveystring
answersAll answers under the surveyarray
answerGroupIDThe answer group unique idlong
responsesarray
questionIdThe question unique idlong
answerIdThe answer unique idlong
answerDateWhen the answer is given. Example: 2017-12-03T00:00:00.00Zdate time
answerThe answer of the questionstring
freeTextAnswerThe text answer of the questionstring
userIdUnique idlong
responderThe responder of the answerstring
answerValuesAll additionals as specified by answerGroupIdarray
answerGroupIDThis id connects to the answer group unique idlong
valuesAll values under the answerGroupIdarray
userIdUnique idlong
descriptionDescription of the value e.g. agent or organizationstring
valueValuestring
timestampWhen answer value is created. Example: 2017-12-03T00:00:00.00Zdate time

API request and response example

curl -X GET "https://api.confidently.fi/api/responses/test/v2/survey/3974/answers?startDate=2019-09-09&endDate=2019-09-12&details=true" -H "Authorization: x-api-key {APIKEY}"

Successful API request returns results in JSON format.

{
  "surveyId": 3974,
  "surveyName": "VoC SMS Survey Demo",
  "answers": [
    {
      "answerGroupId": 3559834502,
      "responses": [
        {
          "questionId": 11445,
          "answerId": 3559834502,
          "answerDate": "2019-09-10T09:18:46.794Z",
          "answer": "9",
          "userId": xxxx,
          "responder": "xxxx"
        }
      ]
    }
  ],
  "answerValues": [
    {
      "answerGroupId": 3559834502,
      "values": [
        {
          "userId": xxxx,
          "description": "Country",
          "value": "Sweden",
          "timestamp": "2019-09-10T09:18:46.794Z"
        }
      ]
    }
  ]
}
Käytämme verkkosivustolla välttämättömiä evästeitä sivuston toiminnan parantamiseen.