Export API

It is possible to export your data using our export API.

You can access the API over HTTP using a POST request. The query language used is GraphQL which returns JSON formatted data.  The API can be found here: https://api.extellio.com/graphql 

Authentication 

All requests to the API need to be authenticated. This is done with a key in the “Authorization” header. If you don’t have a key, you need to contact Extellio to obtain one. The header value should be formatted as a bearer token. 

Authorization: Bearer <key> 

This is only an example key. To receive your API key contact Extellio. 

Schema and playground 

There is a playground that will let you explore and test the API. Click on the “Schema” tab to the right in the playground to see the entire schema and what can be queried. You can run queries directly in the browser and the editor will autocomplete all fields. It’s also possible to generate ready to use curl commands. 

You can find the playground if you open the API endpoint in the browser. Don’t forget to add the authentication header in the “HTTP HEADERS” tab at the bottom. 

Queries 

There are two root queries. surveys is used to get the content and structure of your surveys. That information can then be used to relate and present the information from the surveyResponses-query. 

Example query to get all questions in a survey. The questions list does not reflect the order that the questions are presented to the respondent. To get that you need to get the whole structure, see example below.

query { 
surveys {
id title
questions {
id title
options {
id title
}
settings {
type subType required
}
}
}
}

Example query to get the structure of a survey. root is block which has a children list of surveyContent. surveyContent can contain either a question, a pageBreak or another block. Block can only be in top level content since we only allow one level of nesting.

query { 
  surveys { 
    id title 
    root {         
      children { 
active
        block {
          title
          children {  
active       
            question { 
              id title 
              options { 
                id title 
              } 
              settings { 
                type subType required 
              } 
          }
          }
        }
        question { 
          id title 
          options { 
            id title 
          } 
          settings { 
            type subType required 
          }           
      }      
pageBreak  
      } 
    }     
  }   

Example query to get responses.

query { 
  surveyResponses( 
    surveyId: "<survey id>"   
  ) { 
    respondentId 
    webpageUrl 
    respondedAt 
    questionResponses { 
      questionId optionIds text value 
    } 
  } 
}

Pagination 

If you intend to fetch large amounts of data you must do it in batches since there is a maximum limit of 100 items in each response. Both to reduce the server load and the size of the response body. This can be done with the “first” or “last” and “skip” parameters. As long as the response contains the same amount of items as the parameter, another request can be done with an updated skip value. 

query { 
  surveyResponses(surveyId:"<survey id>", first: 100, skip:100) { 
    id 
  } 

Continuous fetching 

To continuously fetch survey responses it's possible to use the “after” parameter of the “surveyResponses” query. This will only return the entries that comes after entry specified, and with the default sorting of insert order it will return all new entries. 

query { 
  surveyResponses(surveyId: "<survey id>", after: "<id of last response fetched>") { 
    id 
  } 

Other resources 

https://graphql.org/ 

https://www.json.org/ 

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization