REST API

rajapinta, API

Michaela Isaksson avatar
Tekijä: Michaela Isaksson
Päivitetty yli viikko sitten

How to get data from the REST API

Here's an example of the basic workflow of exporting data from the REST API.

You can use for example Postman to test requests to the API.

1. Create a survey and launch it on a touchpoint2. Collect some responses with the survey3. Create an API token to authenticate calls with REST

4. Fire a GET call to the /responses endpoint

On a successful call you will receive a JSON object containing the following fields:

data[]: An array containing 0-100 response objects

paging: An object containing next and previous -fields to navigate between your queries. Any query parameters passed in the url will be also present in the next-field.

You can also query responses individually with the /responses/:id endpoint if you know the id of the response or by full response chains if you need to know all the responses to questions a person responded to in a survey. However, we recommend using the /responses endpoint for the least amount of nested properties and arrays.

You can query the responses with a number of query parameters. Arrays are denoted in the query parameters with a "[]" after the parameter name like so:

/responses?surveyId[]=abc1&surveyId[]=abc2

Note on the preferredLanguage parameter

In cases where a survey has multiple languages, the preferredLanguage parameter determines the language you want the question titles and response choices to be printed with. If the specified translation is not found in the survey, it will first fall back to English and if not found, then fall back on the first available language.

Note on question types and their data

There are 7 question types currently in Feedbackly. The responses are mapped to a multi-purpose "answer"-field and type-safe valueNum/Array/String field depending on the type. The responses are mapped as follows:

Vastasiko tämä kysymykseesi?