A service of the U.S. National Library of Medicine
National Institutes of Health
MedlinePlus offers a search-based Web service that provides access to MedlinePlus health topic data in XML format. Using the Web service, software developers can build applications that utilize MedlinePlus health topic information. The service accepts keyword searches as requests and returns relevant health topics in ranked order. The service also returns health topic summaries, search result snippets and other associated data.
To ensure that the latest information is readily available, the data in the Web service is updated daily, Tuesday - Saturday. Currently, the Web service is only available for English health topics.
The Web service is free of charge, does not require registration or licensing, and allows for unlimited data calls. If you use data from the Web service or build an interface using the Web service, please indicate that the information is from MedlinePlus.gov. If you have questions about the MedlinePlus Web service, or if you would like to share an application that you have built using the service, please contact us.
To receive notification when MedlinePlus releases enhancements to the service or updates the documentation, sign up for our Web service email updates:
Returns MedlinePlus health topic search results for an input query string.
http://wsearch.nlm.nih.gov/ws/query
| Parameter Name | Description |
| db | Database to search. Value is always healthTopics. |
| term | Text query submitted to the Web service. All special characters must be URL encoded. Spaces may be replaced by '+' signs, which represent the AND operator. Represent the OR operator as +OR+. To send a query as a phrase, enclose the phrase in quotes using %22 to represent quotation marks. |
Examples:
http://wsearch.nlm.nih.gov/ws/query?db=healthTopics&term=asthma
http://wsearch.nlm.nih.gov/ws/query?db=healthTopics&term=%22diabetes+medicines%22+OR+%22diabetes+drugs%22
| Parameter Name | Description |
| file | Name of the file containing the document references for the current search. This parameter is required when retstart is being used. The value is obtained from the XML returned from the initial search. The file will expire after a certain period of inactivity, after which, a new request must be initiated. If the file is expired, the XML output will contain an error message. |
| server | Name of the server with the file referenced by the file parameter. This is required when the file parameter is being used. |
| retstart | Sequential index of the first document in the retrieved set to be shown in the XML output (default=0, corresponding to the first record of the entire set). This parameter can be used in conjunction with retmax to download an arbitrary subset of documents retrieved from a search. |
Example:
http://wsearch.nlm.nih.gov/ws/query?file=viv_0Uu9LP&server=qvlbsrch04&retstart=20
| Parameter Name | Description |
| retmax | Total number of documents from the retrieved set to be shown in the XML output (default=10). By default, the web service only includes the first 10 documents retrieved in the XML output. Increasing retmax allows more of the retrieved documents to be included in the XML output. |
Examples:
http://wsearch.nlm.nih.gov/ws/query?db=healthTopics&term=diabetes&retmax=50
http://wsearch.nlm.nih.gov/ws/query?file=viv_0Uu9LP&server=qvlbsrch04&retstart=30&retmax=20
XML
The following is the basic structure of the XML returned:
| Tag Name | Description |
| nlmSearchResult | Basic XML node that contains the response (has no attributes) |
| term | Text query submitted to the Web service |
| file | Name of the file containing the document references for the current search |
| server | Name of the server with the file referenced by the file parameter |
| retstart | Sequential index of the first document in the retrieved set shown in the XML output |
| retmax | Total number of documents from the retrieved set shown in the XML output |
| count | The number of documents in the current result set (non-negative integer) |
| spellingCorrection | Suggested alternative search with a different spelling of the word(s) in the query term(s). This element is not always present. |
| list | The containing element for all of the retrieved documents |
| document | An individual document (MedlinePlus health topic record) |
| Attribute | Type | Description |
| url | Text | MedlinePlus health topic page URL |
| rank | Non-negative integer | Rank of the document in the results. The rank is based on the relevance score as determined by the search engine. Generally, the first document in the first results set will have a rank of zero, and the next document will have a rank of 1, 2, 3, etc. However, if the query string matches a health topic's title or altTitle, that topic will be boosted to the top, regardless of the rank. In these cases the first document in the first results set may have a rank greater than zero. |
| content | Text | Specifies some text associated with its parent document, the MedlinePlus health topic record. The value of content nodes will contain query term identification in the form of <span> tags. The query term will be identified in the <span> tag as qt0, qt1, qt2, etc. |
| Attribute | Type | Description |
| name | Text | The name of the content node. Allowed values are: title, organizationName, altTitle, fullSummary, mesh, groupName, snippet. (See below for a description of content node values.) |
Description of content node values:
| Content Node Value | Description |
| title | Name of the MedlinePlus health topic page |
| organizationName | Organization that produced the MedlinePlus topic page. Value will always be "National Library of Medicine" |
| altTitle | See reference(s) and synonym(s) for the topic. See references and synonyms are undifferentiated in the XML. |
| fullSummary | Text summary of the topic. HTML formatting will be present. |
| mesh | Medical Subject Heading(s) assigned to the topic. |
| groupName | Group(s) to which the topic belongs. A complete list of groups can be found on the MedlinePlus health topics main page. |
| snippet | Brief result summary generated by the search engine, that provides a preview of the relevant content on the topic page. |
Example: