Connecting Power BI to Magpi

Magpi allows Enterprise users to forward their data to other applications.  You can do three useful things this way:

  1. get response data from a specific form
  2. get a Magpi user's list of forms
  3. get a list of questions for a specific Magpi form


To request any of the three types of information above, you'll first create an access token in Magpi, and then enter some parameters into PowerBI.  The entire process should take just a few minutes.


Click any image below to enlarge.

 


Creating an Access Token in Magpi


  1. Log into your Magpi Enterprise account
  2. Click on your username in the upper right corner of the screen, and choose Profile from the menu that will appear.  This will bring you to your Profile page
  3. On the Profile page, click on the Integrations tab
  4. On the Integrations tab (see illustration below), you will see that the top section is for the Magpi API. Click the "Generate New Access Token" button. 
  5. Copy the access token that was created.



The next step will take place in PowerBI, and will depend on which of the three types of data you wish to send to PowerBI (response data, a list of forms, or a list of questions).  Most people will want to send the response data from a specific form, which is detailed in the first section below.


Option 1 - Get Response Data from a Specific Form (4 Steps)

Step 1 - collect the following information which you will enter into PowerBI:


Item

Description

Key Point
URLversion 1: https://app.magpi.com/api/surveydata/?

version 2: https://app.magpi.com/api/surveydata/v2?

Use version 2 if your specific form contains subforms. Otherwise, use version 1.

username

The Magpi account username (not the email address)

add ampersand (&) at the end of the username

accesstoken

The accesstoken generated on the Magpi integration tab (see above). Each accesstoken will only work for the user who generated it.

add ampersand (&) at the end of the accesstoken

surveyid

The Magpi surveyid is not the Magpi form's name. 

Get the surveyID by opening the form in Magpi.  Then look at the URL in your browser address bar. The surveyID is the long number in the URL.  In this example, the surveyID is the highlighted portion (click image to enlarge):

startdate

Start date of the data to be returned. Filtering is done based on the DateStamp and is inclusive.(Optional). 

The date format should be the same one as the one on the data tab in Magpi

enddate

End date of the data to be returned. Filtering is done based on the DateStamp and is inclusive.  (Optional) 

The date format should be the same one as the one on the data tab in Magpi

 

Step 2 - In Power BI Desktop, select Get Data > Web from the Home ribbon:

 

 

Step 3 - Choose the Advanced option, enter the parameters requested, and click Connect. Make sure the URL ends with a question mark (?), and the username and access token end in ampersand (&).






Step 4 - In the Navigator Window which appears, right-click on SurveyData and select Load to load your data into PowerBI:



 


2 - Get a Magpi User's List of Forms (4 Steps)

 

Step 1 - collect the following information which you will enter into PowerBI:


Name

Description

Key Points

URL

https://app.magpi.com/api/surveys/?


username

The Magpi account username (not the email address)

add ampersand (&) at the end of the username

accesstoken

The accesstoken generated on the Magpi integration tab (see above). Each accesstoken will only work for the user who generated it.




Step 2 - In Power BI Desktop, select Get Data > Web from the Home ribbon:

 

 

Step 3 - Choose the Advanced option, enter the parameters requested, and click Connect. Make sure the URL ends with a question mark (?), and the username ends in ampersand (&).

 


 

Step 4 - In the Navigator Window which appears, right-click on SurveyData and select Load to load your data into PowerBI:

 






 


3 - Get a List of Questions for a Specific Magpi Form (4 Steps)

This action gets a list of all questions for the specified form.


Step 1 - collect the following information which you will enter into PowerBI:


Parameters:

Name

Description

Key Point
URLhttps://app.magpi.com/api/questions/?

username

The Magpi account username (not the email address)

add ampersand (&) at the end of the username

accesstoken

The accesstoken generated on the Magpi integration tab (see above). Each accesstoken will only work for the user who generated it.

add ampersand (&) at the end of the accesstoken

surveyid

The surveyid is not the Magpi form's name.

Get the surveyID by opening the form in Magpi. Then look at the URL in your browser address bar. The surveyID is the long number in the URL. In this example, the surveyID is the highlighted portion:

 


Step 2 - In Power BI Desktop, select Get Data > Web from the Home ribbon:



Step 3 - Choose the Advanced option, enter the parameters requested, and click Connect. Make sure the URL ends with a question mark (?), and the username and accesstoken end in ampersand (&).






Step 4 - In the Navigator Window which appears, right-click on Question and select Load to load your form questions into PowerBI: