Forum Discussion
Access to Medallia with APIs
Thank you ... in fact a connector would be good, but the API works. Just trying to find someone who could give some tips on how to use them.
Hi gdecome did you find a solution for this issue?
I'm also trying to connect Medallia to Power BI. In the absence of a connector, a connection via API could be a solution like you said.
- gdecome6 years ago
Helper III
Hi Anonymous, API is working fine. See the example below. You can find more information about what to use in sqlQuery in Medallia documentation for API
1) Create a function in Power Query (e.g. fnGetData)
let
GetData = (sqlQuery) =>
let
authURL = "https://XXXXX.medallia.com/oauth/XXXXX/token",
body = "grant_type=client_credentials&scope=-d&client_id=XXXXX&client_secret=XXXXX",
// Get Token ----------------------------------
getToken = Json.Document(
Web.Contents(
authURL,
[
Headers=[#"Content-Type"="application/x-www-form-urlencoded"],
Content=Text.ToBinary(body)
]
)
),
token = getToken[access_token],
// Get Data ------------------------------------
urlRequest = "https://XXXXX.apis.medallia.com/data/v0/mql",
rawData = Csv.Document(
Web.Contents(
urlRequest,
[
Headers=[Authorization="Bearer " & token ],
Query=[company="XXXXX",output="csv",version="1",query=sqlQuery]
]
)
)
in
rawData
in
GetData
Example of Query to use the function above
let
sqlQuery = "SELECT COUNT(*) FROM survey",
Source = fnGetData(sqlQuery),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
#"Promoted Headers"