...
Info |
---|
We will be adding code snippets in other languages. Added XQuery examples Added an R example Added a Java example Added a SAS example |
...
In this article, you will find several ways to connect to the CDISC Library programmatically using REST API.
Note |
---|
Fictitious CDISC Library credentials are used in these example code snippets. Substitute them with the username and password assigned to you. To request a CDISC Library account, visit https://www.cdisc.org/cdisc-library/api-account-request. |
Python
The objective is to obtain a list of CDISC Controlled Terminology that are loaded into the metadata repository. Two libraries you will need to make a REST API request and store the JSON output:
HTML |
---|
<script src="https://bitbucket.cdisc.org/snippets/b910cfe5151a49bd8d8b530617fd16193e05a70544494a7daec86094efcc80bd.js"></script> |
A REST API GET operation is basically a URL with three parts: base URL, endpoint, path.
HTML |
---|
<script src="https://bitbucket.cdisc.org/snippets/44ee1f9a53d94fd59731b8d03499ff2873f499d565064301a151bbed6dbe4d0a.js"></script> |
You may also specify the output format (or, media type). For JSON, you will specify to accept application/json in the request header:
HTML |
---|
<script src="https://bitbucket.cdisc.org/snippets/0df0b2fcc220457e8f58b0ac7fc38fbfaee895e4724d48da83d3f1a7b9ffd9bd.js"></script> |
XML is an alternate output format you may specify:
HTML |
---|
<script src="https://bitbucket.cdisc.org/snippets/428ea0cd8f3b4af49f1e227345ac0f10b10204ad59844d66ad194982acc5d021.js"></script> |
You can obtain Link to download the full script using CDISC Wiki/Jiraaccount: https://bitbucket.cdisc.org/snippets/8912925345864c31a30d7d7a57ea61cf1cf26161a1b640daad885dd57295e4c2/download. Link to sign up for CDISC Wiki/Jira: https://wiki.cdisc.org/signup.action.
SAS
Below is a sample program to also obtain a list of CDISC Controlled Terminology. This program is compatible with v9.4 and SAS OnDemand for Academics. For further reading about PROC HTTP, visit on-line documentation at https://documentation.sas.com/?docsetId=proc&docsetVersion=9.4&docsetTarget=n1tv5bhcqw9q4ln1btjqicqdqws3.htm&locale=en. Example 9 discusses how to specify HEADER statements for a GET operation. For creating access to SAS OnDemand for Academics, visit https://www.sas.com/en_us/software/on-demand-for-academics.htm.
HTML |
---|
<script src="https://bitbucket.cdisc.org/snippets/a84d469d6e86400f98af62547370b4dc39a1fc0bb4f14ad5969dbb7282bae5dc.js"></script> |
You can obtain the full script using CDISC WIKI/JIRA account:
Link to download this code snippet: https://bitbucket.cdisc.org/snippets/a84d469d6e86400f98af62547370b4dc39a1fc0bb4f14ad5969dbb7282bae5dc/download. Link to sign up for CDISC WIKI/JIRA: https://wiki.cdisc.org/signup.action.
Java
Below is a basic CDISC Library client in Java. This example client, by Jozef Aerts, demonstrates how to get started creating a CDISC Library REST client in java. A valid CDISC Library account is required.Java.
HTML |
---|
<script src="https://bitbucket.cdisc.org/snippets/c81ab9b9e133420e80510465e234f533.js"></script> |
You can obtain the full script using CDISC WIKI/JIRA account:
Link to download this code snippet: https://bitbucket.cdisc.org/snippets/c81ab9b9e133420e80510465e234f533/download. Link to sign up for CDISC Wiki/Jira: https://wiki.cdisc.org/signup.action.
R
Below is a basic CDISC Library client in R, tested using R Studio v1.2.5 with R v3.6. This example demonstrates how to obtain a product catalog using the /mdr/products endpoint. A valid CDISC Library account is required.
HTML |
---|
<script src="https://bitbucket.cdisc.org/snippets/aa1533d6feaa44a5812d223e1dad999ff6589a6c6f7d41239ea6ef0e8be0ce1e.js"></script> |
You can obtain the full script using CDISC WIKI/JIRA accountLink to download this code snippet: https://bitbucket.cdisc.org/snippets/f6589a6c6f7d41239ea6ef0e8be0ce1e/aa1533d6feaa44a5812d223e1dad999f. Link to sign up for CDISC WIKI/JIRAdownload.
XQuery
Below demonstrates how to request a quarter of SEND CT from CDISC Library using XQuery. For technical overview about XQuery, visit https://www.w3.org/TR/xquery/all/.
HTML |
---|
<script src="https://bitbucket.cdisc.org/snippets/9e2db509e6ab43f7a3ac82f06a7aae53.js"></script> |
Link to download this code snippet: https://wikibitbucket.cdisc.org/signup.action/snippets/9e2db509e6ab43f7a3ac82f06a7aae53/download.
Also available is a Java program that incorporates this XQuery method: https://bitbucket.cdisc.org/snippets/5b4e4100c52b4fb2ac633f83d04a4251.