1. Home
  2. Application Programming Interface
  3. PowerBI, how to use Survalyzer API as a data source

PowerBI, how to use Survalyzer API as a data source

Survalyzer offers customers the ability to use PowerBI as an analytics Dashboard. To work with the survey data, several steps are necessary to securely process data.

Disclaimer:

Survalyzer product support does not include Power BI support. If you are stuck and you need help, please get in touch with our sales team

Survalyzer API requires a secure POST request with a BEARER Token authentication, unfortunately the Power BI standard dialog for WEB does not offer UI support.
Step 1 to step 7 are therefore necessary to open the advanced query editor of Power BI. In step 8 we finally script the connection to Survalyzer Next Generation.

To begin, download the latest version of Microsoft Power BI Desktop: https://powerbi.microsoft.com/en-us/downloads/

Step 1: Create a new project

Step 2: Get data

Step 3: Choose Web (as type of data source)

Step 4: Web (as type of data source)

Step 5: Select one table

Step 6: Edit query

Step 7: Open advanced (query) editor

8. Customise the Query / Connect to Survalyzer Next Generation

Finally we are in the advanced editor to connect with Survalyzer Next Generation

Your Survalyzer account is either hosted in Switzerland or the European Union (Holland). The API URL depends on the corresponding data center location
for EUhttps://api.survalyzer-eu.app
for Switzerlandhttps://api.survalyzer-swiss.app

replace the content with the following code:

let
token = Json.Document(Web.Contents(
"https://api.survalyzer-swiss.app/publicapi/Authentication/v1/GetApiToken",
[Headers = [#"Content-Type"="application/json;charset=UTF-8"],
Content = Text.ToBinary("{tenant:""[tenantname]"", userName:""[yourusername]"", password:""[yourpassword]""}", TextEncoding.Utf8)])),

AccessToken = "Bearer " & List.First(Record.ToTable(token)[Value]),
surveyData = Json.Document(Web.Contents("https://api.survalyzer-swiss.app/publicapi/Survey/v1/ReadSurveyDataCompact", [Headers=[Authorization=AccessToken, #"Content-Type"="application/json;charset=UTF-8"], Content = Text.ToBinary("{surveyId:55,loadCodePlan:true}")])),
SurveyDataTable = Record.ToTable(surveyData)

in
SurveyDataTable

The bold parts of the code are the areas to enter customer-specific information.

With these settings, survey data is receivable. Please set the privacy level if asked to do so.

The next step is to put the data into a suitable format and create a sophisticated Dashboard with the capabilities of PowerBI.

This documentation uses screenshot from Microsoft Power BI Desktop Version: 2.85.985.0 64-bit (September 2020).

Updated on October 21, 2020

Was this article helpful?

Related Articles