Info |
---|
Page Under Development |
This page explains how to find use the APIs to:
...
call time.
Check connection to OC.
Verify API based authentication
Why run these APIs?
When the 'OpenClinica Study Data Importer' job takes more time (20-30 minutes) than an expected threshold, it becomes difficult to test the configuration and run the job to sync in the data every time.
In this case, you can cross-check the job completion time by running these APIs using a terminal outside the OpenSpecimen.
Steps to run the APIs
Invoke API to get the token on the terminal.
Expand |
---|
|
Code Block |
---|
curl -X POST \
--data '{"username": "demo_username", "password": "demo_password"}' \
-H "Content-Type: application/json" \
https://qlhc2.build.openclinica.io/user-service/api/oauth/token |
In the above code, the ‘POST’ and ‘Content-Type’ will remain fixed. Code that will vary Server credentials: Username and password Server URL: https://qlhc2.build.openclinica.io will be your OpenClinica OC server URL https://qlhc2.build.openclinica.io : This URL comprises 4 parts, i.e., protocol, hostname, port, and path.
The protocol decides what language should be Protocol: Decides language used for communication between the client and the server. The hostname decides where the server is placed Hostname: Server placement. The port number is optional. When not specified, the protocol defined standard port is used. For https, it is 443. For http, it is 80. The path decides Port number: Optional; default 443 for HTTPS; 80 for HTTP Path: Decides the location of the resource on the host. When not specified, it is /
|
...
After invoking auth API, you will receive a token, as shown |
...
...
. Image Modified Info |
---|
Every time, you will get a new token when you run the auth API. |
|
2. Invoke data API to get the study data
Expand |
---|
|
Code Block |
---|
curl -X GET -H "Accept: application/xml" \
-H "Authorization: Bearer #1step_token" \
"https://qlhc2.openclinica.io/OpenClinica/pages/auth/api/clinicaldata/S_ISPY(TEST)/*/*/*?includeAudits=y&includeDNs=n&includeMedtadata=y&showArchived=n" |
In the above code, the 'GET' and 'Authorization' will remain fixed. Code that will vary Token: #1step_token Use the token from #1 step Server URL: https://qlhc2.build.openclinica.io will be OpenClinica OC server URL Study Name: S_ISPY(TEST) will be the study OID from the OpenClinicaOC. After |
...
Invoking data API, you will know how much time it takes to |
...
download study data. Image Modified |
Once you get the APIs' exact API’s time, you can inform the OpenClinica team (client) to resolve the issue.