Forum Discussion
Connecting PowerBI to REDCap via API with token
Hi All, I found a public REDCap API (see https://cran.r-project.org/web/packages/REDCapR/vignettes/TroubleshootingApiCalls.html which midway down says
If it helps to start with a different REDCap server, you can use this dummy project containing fake data hosted by the OUHSC BBMC. The url is https://bbmc.ouhsc.edu/redcap/api/. There are three key-value pairs: (1) the ‘token’ is 9A81268476645C4E5F03428B8AC3AA7B, (2) the ‘content’ is record, and (3) the ‘format’ should be CSV. When checking your own server, the token value should change, but the content and format should not. It should return five records in a CSV format. The ‘status’ should be 200 OK.
I installed Postman in Chrome and tried the dummy API at bbmc and both it, and my API work within Postman. It is clearly an error that I am having in trying to set up PowerBI.
I tried to set up a very simple connection like this but I still get an error Details: "Web.Contents failed to get contents from 'https://bbmc.ouhsc.edu/redcap/api/' (501): Not Implemented"
It was two issues:
- I need to change to x-www-form-urlencoded
- There were serious formating errors with both the Headers and the Content
let
actualUrl = "https://bbmc.ouhsc.edu/redcap/api/",
record =[token="9A81268476645C4E5F03428B8AC3AA7B",
content="record",
format="csv"
],
body = Text.ToBinary(Uri.BuildQueryString(record)),
options = [Headers =[#"Content-type"="application/x-www-form-urlencoded"], Content=body],
result = Web.Contents(actualUrl, options)
in
result
- v-lid-msft6 years ago
Community Support
Hi DBirdmanAR ,
Your query works well on my side, we tried to convert the result with csv format and get the dummy data as the document. If you have any other questions , please kindly ask here and we will try to resolve it.
Best regards,- 274188A5 years ago
Advocate I
Perfect for my needs - a year later but THANKS!! Life Saver.
Is there a limit on the number of fields I can connect to? I have 250!
Cheers,
John
- Dianamoor4 years agoNew Member
Hi guys,
I'm new in power BI and I wanna make the same connexion RedCap => power BI above with token
Can you please show me what I must set in parameters header :
Url :...
token:..
content:record
format:csv
I download the file example but i didn't found the way 😞
Thank very much for your help
Diana
- v-lid-msft6 years ago
Community Support
Hi DBirdmanAR ,
How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?
Best regards, - jcellefson1 year agoNew Member
Your insight still works 😀