We hope you'll join us for our 4/23 webinar on using data tables to apply reference ranges and AE codes in OC4. For more information and to register, visit https://register.gotowebinar.com/register/2882170018956684555

Retrieve StudySubjects from Person ID?

Is there any way through WS (either SOAP or REST) to find of finding which SubjectStudy are associated to Person unique ID?


  • toskriptoskrip Posts: 279 ✭✭✭
    To my knowledge there is only the expensive way. Get all the StudySubjects and filter them by PersonID on the client side.

  • giladhosgiladhos Posts: 11
    Hey can I join thread? :)

    I'm trying to get all study subject as said here with GET:
    This is from documentation:

    I am getting HTTP 302(found) back, it seems I'm being redirected to OpenClinica/pages/login/login (Location value in response).
    I am asked to answer oAuth2 challenge - 'Www-Authenticate: OAuth2', not sure what to do next, even more confusing is that in more than a few places in documentation it says api_key is the method used in OC.

    If anyone can clear this up would be great.

    Many thanks

  • toskriptoskrip Posts: 279 ✭✭✭

    the authentication mechanism for existing REST APIs is not harmonised yet (hopefully will be with OC4 on the horisont). RESTful URLs that you are trying to use work with standard user session. You have to emulate user login into OC with POST to OC login and user the stored session for another GET call.

    This I have already described in another post on the forum here:

    REST Call to login to OpenClinica


  • giladhosgiladhos Posts: 11
    edited September 2016
    ok, that's clearing some things up for me.

    I'm still nowhere with it though since I'm not using curl and localhost:8080/OpenClinica/j_spring_security_check gets me the same 302 response. I added j_username and j_password as POST parameters.
    (even tried all combinations with/without "j_" )

    I'm trying to parse with json using java and filter it according to any field the users will choose.

    I did manage to run http://openc1.bgu.ac.il/OpenClinica/pages/login/login and get:
    output said:

    div ID="login">
    form action="/OpenClinica/j_spring_security_check;jsessionid=EF4DAA8D2AC033858C5E0C369105E101" method="post">
    b>User Name /b>
    div class="formfieldM_BG">
    input type="text" id="username" name="j_username" class="formfieldM">
    div class="formfieldM_BG">
    input type="password" id="j_password" name="j_password" class="formfieldM" autocomplete="off">
    input type="submit" name="submit" value="Login" class="loginbutton" />
    a href="#" id="requestPassword"> Forgot Password?
    !-- Alert Box -->
    !-- End Login box contents -->Hi,

    *I ruined some of that html so that it stays text*

    from which I can see the address /OpenClinica/j_spring_security_check you were refering to, with method = post .

    Do you know the way for this to wokr correctly?

    Many thanks!
  • toskriptoskrip Posts: 279 ✭✭✭

    it depends on which HTTP client library you are using. If it is jersey have a look at the last getOcRestfulUrl method of the following helper class:


    basically emulates POST with with login form data in MultivaluedMap. After successful login retrieving the jsessionid and creating a cookie. And than later using this cookie to perform authenticated GET for OC Restful URL.

Sign In or Register to comment.