Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page provides explains how to use the APIs for the OC call; by calling these APIs, you can find out how much time the API call takes for a specific study. Follow the below steps to run the APIs.to:

  • Find the API call time.

  • Check connection to OC.

  • Verify API based authentication

Why run these APIs?

When the 'OpenClinica Study Data Importer' job takes time (20-30 minutes), it becomes difficult to test the configuration and run the job to sync in the data.

Steps to run the APIs

  1. Invoke API to get the token on the terminal.

Expand
titleClick to 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 above code, ‘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 OC server URL

https://qlhc2.build.openclinica.io: This URL comprises 4 parts, i.e., protocol, hostname, port, and path.

  • Protocol: Decides language used for communication between the client and the server.

  • Hostname: Server placement.

  • Port number: Optional; default 443 for HTTPS; 80 for HTTP

  • Path: Decides the location of the resource. When not specified, it is /

After invoking auth API, you will receive a token, as shown below.

Image Added
Info

Every time, you will get a new token when you run the auth API.

2. Use the token and invoke Invoke data API to get the study data

Expand
titleClick to 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 token from #1 step

Server URL: https://qlhc2.build.openclinica.io OC server URL

Study Name: S_ISPY(TEST)

...

study OID from the

...

OC.

...

After

...

Invoking data API, you will

...

know how much time

...

it

...

takes to

...

download study data.

Image Added

Once you get the API’s time, you can inform the OpenClinica team to resolve the issue.