Connecting Power BI to Magpi


This document describes the Magpi Outbound API, which allows Magpi Enterprise client users to pull information from the Magpi server at www.magpi.com to Power BI. To fetch subform data, please use version 2 url on the Get Survey Data API (see #3 "List Surveys" below). 

The Magpi API allows Enterprise users' client applications to request :

  1. a list of a forms
  2. a list of questions for a specified form
  3. form data

The data is returned as an XML representation. All API calls must take place over HTTPS .

 


Creating an Access Token in Magpi

To use the API,first create an access token on the API settings page - the page can be accessed by clicking the Settings link at the top of any Magpi page, and then choosing the API tab. The access token is used together with the username (not the email address) of the user who generated it, to authenticate an API call.


 


1 - List Surveys

Description:

This action gets a list of all the Magpi forms for which the user has data view access.

version 1 URL: https://app.magpi.com/api/surveys/

 

Parameters:

Name

Description

username

The account username

accesstoken

The accesstoken generated on the Magpi site. Each accesstoken is associated with the user who generated it




Open Power BI, and on the menu bar select Home and click on Get data option. Then Select Web.

 

 

Choose Advanced option and proceed as follows:


URL - add a question mark at the end of the url

Username - add ampersand at the end of  the username

 


 

Right click on the survey and select either Transform Data or Load

 






 


2 - List Questions


Description:

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


version 1 URL: https://app.magpi.com/api/questions/


Parameters:

Name

Description

Key Point
URLThe API URLadd a question mark at the end of the URL

username

The account username.

add ampersand (&) at the end of the username

accesstoken

The accesstoken generated on the site.Each accesstoken is associated with the user who generated.

add ampersand at the end of the accesstoken

surveyid

The surveyid is not the form's name.The surveyid can be obtained from the list of forms generated in 1 above.


 








Right click on the Question and select either Transform Data or Load






3 - Get Survey Data

 

Description:

This action gets the data for the form specified in the request parameters.

version 1 URL: https://app.magpi.com/api/surveydata/

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

 

Note: Version 2 of the Get Survey Data, allows you to fetch sub-form data. 

 

Parameters:

Name

Description

Key Point
URLThe URL from the API, shown aboveadd question mark at the end of the url

username

The account username.

add ampersand (&) at the end of the username

accesstoken

The accesstoken generated on the site. Each accesstoken is associated with the user who generated.

add ampersand (&) at the end of the accesstoken

surveyid

The surveyid is not the survey's name. The surveyid can be obtained from the list of forms generated in 1 above.


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/ The date format should be the same one as the one on the data tab


enddate

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


 

 

Key Points


URL - add question mark at the end of the url

Username - add ampersand at the end of the username

Accesstokenadd ampersand at the end of the accesstoken

 

 

version 1 URLhttps://app.magpi.com/api/surveydata/



version 2 URLhttps://app.magpi.com/api/surveydata/v2




Right click on the SurveyData and select either Transform Data or Load