NIH | National Cancer Institute | NCI Wiki  

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Enclosed contents of page in Lorenzo's custom macro instead of the standard numbered headings macro.

Include Page
caDSR API Examples Overview include
caDSR API Examples Overview include

This page includes the following topics.

Overview

Using the API, developers can allow an application to connect to caDSR and search the database. The API is available on the download center.

The caDSR HTTP API (XML-HTTP API) and CDE Browser provide access to, and a means of linking to, caDSR metadata through a standard internet browser.

caDSR HTTP API results are displayed in XML format and can be displayed in an internet browser or by means of an XSLT stylesheet. The caDSR 4.0 Technical Guide describes the caDSR XML-HTTP API and provides a catalog of the caDSR operations and search criteria.

A few simple examples of caDSR operations are provided below. The attached MS Word documents for the examples show sample results and the "http" statements used to produce the results, and provide information about how to interpret the results.

Examples

Example 1

Find a Data Element where Public Id = 2178693 and Version=2.1 and display the basic metadata attributes.

Either the CDE Browser or the caDSR HTTP API can be used to satisfy this query and results from both are shown below.

Example 1 Results Displayed in the CDE Browser

This method can be used to retrieve Data Elements only when you know both the Public ID and Version number.  (If you have trouble with the following link in Firefox, cut and paste it into IE.)

https://cdebrowser.nci.nih.gov/CDEBrowser/search?dataElementDetails=9/&cdeId=2178693&version=2.1&PageId=DataElementsGroup&queryDE=yes&FirstTimer=yes

Or alternatively

http://freestyle.nci.nih.gov/freestyle/do/cdebrowser?publicId=2178693&version=2.1

Sample CDE Browser Output from Example 1

Example 1 Results Displayed in XML

The URL for the results from the caDSR

4.0 HTTP

II REST API is

:

Custom nh
start-numbering-with1
start-numbering-ath2
Panel
titleContents of This Page

Table of Contents
maxLevel3

Find Data Element by Public ID and Version

The following examples find a data element where Public ID = 62 and Version=6, displaying the basic metadata attributes. 

Results Displayed in XML

The URL for the results from the caDSR II REST API is

Code Block
https://cadsrapi.cancer.gov/invoke/caDSR/GetXML?query=DataElement[@publicId=62,@version=6]

Results Displayed in HTML

The URL for the results from the caDSR II REST API is

Code Block
https://cadsrapi.cancer.gov/invoke/caDSR/GetHTML?query=DataElement[@publicId=62,@version=6]

Results Displayed in JSON

Section
Column
width25%
Panel
titleLinks

Child pages

Children Display
Column
Code Block
http
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi40
caDSR/
GetXML
GetJSON?query=DataElement[@publicId=62,@version=
2178693][@version=2.1]

Example 2

Find a Data Element with Public Id = 2178693, display the basic metadata attributes, version is not known.

6]

Allow Machine-to-machine Retrieval of a Data Element by Public ID and Version

The following caDSR II example allows machine-to-machine retrieval of a data element by public ID and version. (You can test this URL only in a machine-to-machine scenario, not in a browser.)

Code Block
https://cadsrapi.cancer.gov/rad/caDSR.restapi:GetXML_rad/GetXML/query=DataElement[@publicId=62,@version=6]

If you want to create a REST API call from machine to machine or application to application, start your URL as follows: 

Code Block
https://cadsrapi.cancer.gov/rad/caDSR.restapi:GetXML_rad/

Find Data Element by Public ID

The following example finds a data element with Public ID = 62, displaying the basic metadata attributes. Since the version is not known, this query can only be handled via a caDSR

HTTP

REST API query getting all versions.

The URL for the results from the caDSR

4.0 HTTP

II REST API is

:

Code Block
http
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi40
caDSR/
GetXML
GetHTML?query=DataElement[
publicId
@publicId=
2178693
62]

Sample caDSR HTTP API XML Output from Example 2

Example 3

Find a Data Element with Public Id = 2178693, display

Or the query can retrieve only the latest version.

Code Block
https://cadsrapi.cancer.gov/invoke/caDSR/GetHTML?query=DataElement[@publicId=62,@latestVersionIndicator=yes]

Find Data Element by Public ID, Display All Related Components

The following example finds a data element with Public ID = 62, displaying all the metadata associated with the

Data Element

data element's related components, not just the basic attributes.

This is handled in the caDSR

HTTP

REST API using a parameter that produces expanded ("heavy") XML.

The URL for the results from the caDSR

4.0 HTTP

II REST API is

:

Code Block
http
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi40
caDSR/GetXML?query=
DataElement&
DataElement[@publicId=
2178693
62]&returnHeavyXML=true

Sample caDSR HTTP API XML Output from Example 3 with "Heavy" XML

Example 4

Find all the Data Elements associated with the Data Element Concept with Public Id = 2178546, display

Find DEC Using Public ID, Display All Associated Data Elements

The following example finds all the data elements associated with the DEC with Public ID = 2178546, displaying the basic metadata of the

Data Element Concept

DEC and its

Data Elements

data elements.

The URL for the results from the caDSR

4.0 HTTP

II REST API is

:

Code Block
http
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi40
caDSR/
GetXML
GetHTML?query=DataElement&DataElementConcept[@publicId=2178546]
Example 5

Find

only

Data Elements Associated with a Particular DEC Public ID and Version

The following example finds only data elements associated with

VERSION

Version 2.1 of

Data Element Concept

DEC with Public

Id

ID = 2178546.

The URL for the results from the caDSR

4.0 HTTP

II REST API is

:

Code Block
http
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi40
caDSR/GetXML?query=DataElement&DataElementConcept[@publicId=2178546
][
,@version=2.1]

Sample caDSR HTTP API XML Output from Example 4 and 5

Example 6

Find a Form where Public Id = 2392775 and Version=1.0 and display the basic metadata attributes.

Either the Form Builder or the caDSR HTTP API can be used to satisfy this query and results from both are shown below.

Example 6 Results Displayed in the Form Builder

This method can be used to retrieve Forms only when you know both the Public ID and Version number.  (If you have trouble with the following link in Firefox, cut and paste it into IE.)

https://formbuilder.nci.nih.gov/FormBuilder/formDetailsAction.do?method=getFormDetails&formIdSeq=FF04F699-FE6A-56AA-E034-0003BA3F9857

Example 6 Results Displayed in XML

Get Data Elements Using Concept Code or Concept Name

The following examples show how to retrieve data elements using either the concept code or the concept name where the concept is the Primary concept of the related caDSR item. In these examples, results are returned in XML. 

Find All Data Elements Where Associated Concept is Primary Concept of Data Element's Object Class

This example shows the use of the Concept Code (C19448). Results are returned in XML.

The URL for the results from the caDSR

4.0 HTTP

II REST API is

:

Code Block
http
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi40
caDSR/GetXML?query=
Form[@publicId=2392775][@version=1.0]

Example 7

Find a Form with Public Id = 2392775, display the basic metadata attributes, version is not known.

Since the version is not known, this query can only be handled via a caDSR HTTP API query.

DataElement,DataElementConcept,ObjectClass&ComponentConcept[Concept[@preferredName=C19448],@primaryFlag=Yes]

Find All Data Elements Where Associated Concept is Primary Concept of Data Element's Property

The URL for the results from the caDSR

4.0 HTTP

II REST API is

:

Code Block
http
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi40
caDSR/GetXML?query=
Form[publicId=2392775]

Example 8

Find a Form with Public Id = 2392775, display all the metadata associated with the Data Element's related components, not just the basic attributes.

This is handled in the caDSR HTTP API using a parameter that produces expanded ("heavy") XML.
DataElement,DataElementConcept,Property&ComponentConcept[Concept[@preferredName=C42775],@primaryFlag=Yes]

Find All Data Elements Where Associated Concept is Primary Concept of One of Data Element's Value Domain Value Meanings

The URL for the results from the caDSR

4.0 HTTP

II REST API is

:

Code Block
http
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi40
caDSR/GetXML?query=
Form&Form[@publicId=2392775]&returnHeavyXML=true

Example 9

Find all the Forms associated with the CDE with Public Id = 2183364, Version 1.0, display the basic metadata of the Form
DataElement,ValueDomain,ValueDomainPermissibleValue,PermissibleValue,ValueMeaning&ComponentConcept[Concept[@preferredName=C19448],@primaryFlag=Yes]

Find All Enumerated Permissible Values for a Data Element

The following examples find all enumerated permissible values for a data element using the data element's public ID and version or the data element's public ID (and getting latest version). You must specify either version or latestVersionIndicator. If you specify latestVersionIndicator=No, the query returns all permissible values across all versions of the CDE.

The URL for the results from the caDSR

4.0 HTTP

II REST API is

:

http

https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi40
caDSR/GetXML?query=
gov.nih.nci.cadsr.domain.Module&gov.nih.nci.cadsr.domain.Form[@version=1.0][@publicID=2392775]
PermissibleValue,ValueDomainPermissibleValue,ValueDomain&DataElement[@publicId=106,@latestVersionIndicator=Yes] 
Code Block
http
https://cadsrapi.
nci.nih
cancer.gov/invoke/
cadsrapi40
caDSR/GetXML?query=
Form&Module&Question&
PermissibleValue,ValueDomainPermissibleValue,ValueDomain&DataElement[@publicId=
2183364][
106,@version=5.1
.0
]

Example 10

Get all the modules for form with publicID=2392775.

The URL for the results from the caDSR 4.0 HTTP API is:

Code Block