RxClass API
getClassTree
- Information returned
- Subclasses or descendants of the specified class
- Service domain
- https://rxnav.nlm.nih.gov
- HTTP request
- GETÂ /REST/rxclass/classTree.xml?classId=value&classType=value
Description
Get the class tree rooted at a class of the specified classId and classType. The class tree represents that class and the classes that are its descendants.
The results cover only one class type. The classType parameter, which restricts the results to a particular class type, should be specified when using a MeSH identifier because some MeSH concepts exist in more than one RxClass tree. To find all trees that contain a concept, use getClassContexts.
Parameters
Parameter | Location | Use | Description | Default |
---|---|---|---|---|
format | Path | Optional | Notation for results One of:
| .xml |
classId | Query | Required | Class identifier | |
classType | Query | Optional | Class type (See getClassTypes for the menu.) |
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
- rxclassTree (array)
- rxclassMinConceptItem
- 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
- rxclassTree ...
- ...
Example: Descendants of Cytochrome P450 Inducers (NUI=N0000185505)
XML: https://rxnav.nlm.nih.gov/REST/rxclass/classTree?classId=N0000185505
JSON: https://rxnav.nlm.nih.gov/REST/rxclass/classTree.json?classId=N0000185505
An XML result is shown below.
<rxclassdata> <rxclassTree> <rxclassMinConceptItem> <classId>N0000185505</classId> <className>Cytochrome P450 Inducers</className> <classType>MOA</classType> </rxclassMinConceptItem> <rxclassTree> <rxclassMinConceptItem> <classId>N0000185507</classId> <className>Cytochrome P450 2C9 Inducers</className> <classType>MOA</classType> </rxclassMinConceptItem> </rxclassTree> <rxclassTree> <rxclassMinConceptItem> <classId>N0000185607</classId> <className>Cytochrome P450 2C19 Inducers</className> <classType>MOA</classType> </rxclassMinConceptItem> </rxclassTree> <rxclassTree> <rxclassMinConceptItem> <classId>N0000187063</classId> <className>Cytochrome P450 2C8 Inducers</className> <classType>MOA</classType> </rxclassMinConceptItem> </rxclassTree> <rxclassTree> <rxclassMinConceptItem> <classId>N0000187064</classId> <className>Cytochrome P450 2B6 Inducers</className> <classType>MOA</classType> </rxclassMinConceptItem> </rxclassTree> <rxclassTree> <rxclassMinConceptItem> <classId>N0000190118</classId> <className>Cytochrome P450 3A Inducers</className> <classType>MOA</classType> </rxclassMinConceptItem> <rxclassTree> <rxclassMinConceptItem> <classId>N0000185506</classId> <className>Cytochrome P450 3A4 Inducers</className> <classType>MOA</classType> </rxclassMinConceptItem> </rxclassTree> <rxclassTree> <rxclassMinConceptItem> <classId>N0000191268</classId> <className>Cytochrome P450 3A5 Inducers</className> <classType>MOA</classType> </rxclassMinConceptItem> </rxclassTree> </rxclassTree> <rxclassTree> <rxclassMinConceptItem> <classId>N0000191267</classId> <className>Cytochrome P450 2D6 Inducers</className> <classType>MOA</classType> </rxclassMinConceptItem> </rxclassTree> <rxclassTree> <rxclassMinConceptItem> <classId>N0000191624</classId> <className>Cytochrome P450 1A Inducers</className> <classType>MOA</classType> </rxclassMinConceptItem> <rxclassTree> <rxclassMinConceptItem> <classId>N0000191266</classId> <className>Cytochrome P450 1A2 Inducers</className> <classType>MOA</classType> </rxclassMinConceptItem> </rxclassTree> </rxclassTree> <rxclassTree> <rxclassMinConceptItem> <classId>N0000193955</classId> <className>Cytochrome P450 2E1 Inducers</className> <classType>MOA</classType> </rxclassMinConceptItem> </rxclassTree> </rxclassTree> </rxclassdata>