APIs

RxClass API

getClassContexts

Information returned
Paths from the specified class to the root of its class hierarchies
Service domain
https://rxnav.nlm.nih.gov
HTTP request
GET  /REST/rxclass/classContext.xml?classId=value

Description

Get the contexts of a class. A context is a path (a sequence of classes), starting with classId, then an immediate superclass, then a superclass of the superclass, and so on, ending with the root of a class hierarchy.

If a class source does not specify class contexts, then they are implicit in the class hierarchy: getClassContexts returns all routes from classId to the root (see getClassGraphBySource).

Parameters

ParameterLocationUseDescriptionDefault
formatPathOptional

Notation for results

One of:
.xml
Get results in XML
.json
Get results in JSON
.xml
classIdQueryRequiredClass identifier

All query parameters are case-insensitive.

Note that HTTP requires that query parameters be "URL encoded". For full information on URL encoding, please refer to IETF RFC 3986, "Uniform Resource Identifier".

Output structure

Results are available as either XML or JSON.

  • The XML result has the root element rxclassdata. It is described in the XML Schema for the RxClass API; the relevant element structure is summarized below. Elements that would be empty might be left out.

  • The JSON result is an object {...}, analogous to the content of the XML rxclassdata. Fields that might occur multiple times in the XML are expressed as an array. Fields that would be empty might be null or left out. Numbers are expressed as strings.

Both XML and JSON results follow the same outline:

rxclassdata
Root element in XML, or anonymous object in JSON
classPathList
classPath (array)
rxclassMinConcept (array)
Drug class
classId
Class identifier (an ID in the namespace of the class source)
className
Class name
classType
Class type (ATC1-4, CHEM, DISPOS, EPC, VA, etc.)
classUrl
Link to the class source

Example: Context of Antivenins (MeSH id=D000997)

XML: https://rxnav.nlm.nih.gov/REST/rxclass/classContext?classId=D000997

JSON: https://rxnav.nlm.nih.gov/REST/rxclass/classContext.json?classId=D000997

An XML result is shown below.

<rxclassdata>
    <classPathList>
        <classPath>
            <rxclassMinConcept>
                <classId>D000997</classId>
                <className>Antivenins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D000992</classId>
                <className>Antitoxins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D007106</classId>
                <className>Immune Sera</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D000906</classId>
                <className>Antibodies</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D007136</classId>
                <className>Immunoglobulins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D007162</classId>
                <className>Immunoproteins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D001798</classId>
                <className>Blood Proteins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D011506</classId>
                <className>Proteins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D000602</classId>
                <className>Amino Acids, Peptides, and Proteins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>Z2</classId>
                <className>Substances [EXT]</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>Z1</classId>
                <className>Substances and cells</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
        </classPath>
        <classPath>
            <rxclassMinConcept>
                <classId>D000997</classId>
                <className>Antivenins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D000992</classId>
                <className>Antitoxins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D007106</classId>
                <className>Immune Sera</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D000906</classId>
                <className>Antibodies</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D007136</classId>
                <className>Immunoglobulins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D012712</classId>
                <className>Serum Globulins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D001798</classId>
                <className>Blood Proteins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D011506</classId>
                <className>Proteins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D000602</classId>
                <className>Amino Acids, Peptides, and Proteins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>Z2</classId>
                <className>Substances [EXT]</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>Z1</classId>
                <className>Substances and cells</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
        </classPath>
        <classPath>
            <rxclassMinConcept>
                <classId>D000997</classId>
                <className>Antivenins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D000992</classId>
                <className>Antitoxins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D007106</classId>
                <className>Immune Sera</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D000906</classId>
                <className>Antibodies</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D007136</classId>
                <className>Immunoglobulins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D012712</classId>
                <className>Serum Globulins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D005916</classId>
                <className>Globulins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D011506</classId>
                <className>Proteins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D000602</classId>
                <className>Amino Acids, Peptides, and Proteins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>Z2</classId>
                <className>Substances [EXT]</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>Z1</classId>
                <className>Substances and cells</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
        </classPath>
        <classPath>
            <rxclassMinConcept>
                <classId>D000997</classId>
                <className>Antivenins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D000992</classId>
                <className>Antitoxins</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D007106</classId>
                <className>Immune Sera</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D001688</classId>
                <className>Biological Products</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>D045424</classId>
                <className>Complex Mixtures</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>Z2</classId>
                <className>Substances [EXT]</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
            <rxclassMinConcept>
                <classId>Z1</classId>
                <className>Substances and cells</className>
                <classType>CHEM</classType>
            </rxclassMinConcept>
        </classPath>
    </classPathList>
</rxclassdata>