RxClass API
getSpellingSuggestions
- Information returned
- Drug or class names similar to a given string
- Service domain
- https://rxnav.nlm.nih.gov
- HTTP request
- GETÂ /REST/rxclass/spellingsuggestions.xml?type=value&term=value
Description
Get spelling suggestions for a given drug or class name (the name parameter). Select "drug" or "class" with the type parameter.
The suggestions are class or class-member names, listed in decreasing order of closeness to the original phrase.
Parameters
Parameter | Location | Use | Description | Default |
---|---|---|---|---|
format | Path | Optional | Notation for results One of:
| .xml |
type | Query | Optional | Scope of search One of:
| DRUG |
term | Query | Required | Possibly misspelled name |
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
- suggestionList
- suggestion (array)
- Class or drug name
Example: Classes like "marcolides"
XML: https://rxnav.nlm.nih.gov/REST/rxclass/spellingsuggestions?term=marcolides&type=CLASS
JSON: https://rxnav.nlm.nih.gov/REST/rxclass/spellingsuggestions.json?term=marcolides&type=CLASS
An XML result is shown below.
<rxclassdata> <suggestionList> <suggestion>macrolides</suggestion> </suggestionList> </rxclassdata>