Info |
---|
Page Under Development |
This page explains how to find to use the APIs to:
Find the API
...
Also, you can check whether it is possible to connect to OpenClinica from OpenSpecimen and to verify if the API based authentication is working or not.
...
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 every time and run the job to sync in the data.
In this case, you can cross-check the time taken by the job to complete 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 | ||
---|---|---|
| ||
In |
...
above code, |
...
‘POST’ and ‘Content-Type’ will remain fixed. Code that will |
...
vary Server credentials: Username and password Server URL: |
...
Once you run the above code, you will receive a token as shown in the below image.
...
Info |
---|
Every time, you will get a new token when you run the auth API.OC server URL
|
...
, i.e., protocol, hostname, port, and |
...
path. |
...
|
...
|
...
|
...
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.
|
...
After invoking auth API, you will receive a token, as shown below.
|
2. Invoke data API to get the study data
Expand | ||
---|---|---|
| ||
In the above code, the 'GET' and 'Authorization' will remain fixed. Code that will |
...
vary Token: |
...
token from #1 step Server URL: |
...
OC server URL Study Name: |
...
study OID from the |
...
OC. After |
...
Invoking data API, you will know how much time it takes to |
...
download study data. |
Once you get the APIs' exact API’s time, you can inform the OpenClinica team (client) to resolve the issue.