Please join your peers on either March 26 (8pm GMT) or March 28 (8am GMT) to watch as user extraordinaire and forum legend @"lindsay.stevens" demonstrates OpenClinica Insight.

See preview and register at https://openclinica.com/insight-webinar

Insight makes it easy to ask questions of ALL of your clinical and operational data and visualize answers via interactive reports and dashboards. The idea is simple, but the results are powerful: ask your questions, choose your visualizations, then return often for updated, interactive results that link you to all of the underlying data.

REST Call to login to OpenClinica

I am using curl to run some tests to Login and do some test automation on studies, i am not able to login and get exact header, url and body that i need to use. can someone give me a sample of how i can login. I looked at documentation but i am not able to figure out from that.

Comments

  • toskriptoskrip Posts: 255 ✭✭
    Hi,

    you need two requests to perform RESTfull URL call to OC. First is the post request in order to trigger login mechanism of spring security, which will open a session (with cookie) for you. And the second is get request to specific RESTfull endpoint. The second request need to reuse the session that was created by first request. With curl you simple store cookie in extra file and reuse it during second request. Here is an example:

    curl d j_username=root -d j_password=12345678 --cookie-jar ./session http://localhost:8080/OpenClinica/j_spring_security_check

    curl --cookie ./session http://localhost:8080/OpenClinica/rest/clinicaldata/json/view/S_DEFAULTS1/SS_01/*/*

    best

    Tomas
  • yogiyogi Posts: 25
    Hi,
    that works fine. But what is if i want to get the html casebook of an subject :D then OpenClinica needs some time to process. But CURL get´s a page but only this one that we have to wait :D

    Any ideas?

    Best,
    Holger
  • toskriptoskrip Posts: 255 ✭✭
    Hi,

    yes, the thing is html casebook was designed to be used within OC only (or within a browser). It will be complicated to use html casebook from CURL because it seems to be that the page that you get back (about the need of time to process) has lot of java script that need to be executed (normally browser does that) in order to generate the html casebook. CURL is not executing the java script (there is no java script execution engine in CURL). You would have to process result that you get back with something that can execute the underlying javascript in order to get the final html report.

    Tomas
Sign In or Register to comment.