REDCap API to Shiny problems

439 views
Skip to first unread message

valeri...@sanfordhealth.org

unread,
Oct 4, 2017, 5:47:16 PM10/4/17
to shinyapps.io Users
I am developing a Shiny app that grabs data from a REDCap API which is a web application for building surveys.  There is limited capability with REDCap so I want to grab data from the survey and use a Shiny app to finish the survey.  I have tried mutliple REDCap API packages [redcapAPI, REDCapR, RCurl] and each one gives the same results.  The problems:
  1. While running the app on my local computer, I can only get the data from the API if I do not include the "s" in my URL [http vs https].  So my first question is, why does it only work without the "s"?  All examples I have seen show the URL as https.  So it works on my local computer if the URL starts only with http.  
  2. Then I deploy the app to shinyapps.io and it does not work.  There are no errors in RStudio when it deploys but when it loads in the browser it turns grey right away and is 'Disconnected from the server.'.  I looked the Log for the app and the following warnings and errors occur:
    •   Warning: Error in curl::curl_fetch_memory: Could not resolve host:
    •  Error in curl::curl_fetch_memory(url, handle = handle) : Could not resolve host: 
Has anyone else experienced this issue with another API or possibly with REDCap API?  Is it a problem that the URL is http and not https?  I've looked through other forums and cannot find a solution.

Thank you!

Message has been deleted

valeri...@sanfordhealth.org

unread,
Oct 4, 2017, 5:55:37 PM10/4/17
to shinyapps.io Users
I've also looked at the JavaScript console which gives the following sequence:
  • Connection opened. 
  •  [DBG]: Open channel 0
  •  [INF]: Connection closed. Info: {"type":"close","code":4702,"reason":"Shiny connection closed","wasClean":true}
  •  [DBG]: SockJS connection closed
  •  [DBG]: Channel 0 is closed
  •  [DBG]: Removed channel 0, 0 left
I also made a simple app that just pulled the data and prints the first row and the same problem occurs.

Joshua Spiewak

unread,
Oct 5, 2017, 9:26:30 AM10/5/17
to shinyapps.io Users
What is the URI you are using to connect to? It needs to be a publicly available internet address in order for shinyapps.io to connect to it.

If you are hosting it yourself, and you are not serving it on port 443 with a valid SSL certificate, then HTTPS will not work.

Valeri...@sanfordhealth.org

unread,
Oct 5, 2017, 9:34:49 AM10/5/17
to shinyapps.io Users
It's: http://redcapwebdev.sanfordhealth.org/redcap/api/ - which can't be accessed outside of work.  So that makes sense.  Do you know if there's a work around for this while still using shinyapps.io?  Or would utilizing the Shiny Server work?    

Joshua Spiewak

unread,
Oct 5, 2017, 9:41:26 AM10/5/17
to shinyapps.io Users
Access would need to be allowed from the shinyapps.io servers, this is similar to what is documented for accessing a database.

Otherwise, yes, you would need to run Shiny Server within the same network so it can access that URL.

Valeri...@sanfordhealth.org

unread,
Oct 5, 2017, 9:42:50 AM10/5/17
to shinyapps.io Users
This is helpful, thank you for your help!


Reply all
Reply to author
Forward
0 new messages