Application Development Support: Web Services

NOTICE

December 1, 2015

DailyMed is changing its base URLs from HTTP to HTTPS.
The new base URL for the web application is: https://dailymed.nlm.nih.gov/
The new base URL for the web service is: https://dailymed.nlm.nih.gov/dailymed/services/
If you are using our web services with HTTP, please update your code to use HTTPS by January 31, 2016. After that date, HTTP access will be disabled. If you have questions about the switch to HTTPS, please visit our customer support.

RESTful API

The DailyMed RESTful API is a web service for accessing current SPL information. It is implemented using HTTP and can be thought of as a collection of resources, specified as URIs. Some characteristics of the DailyMed RESTful API:

  • View the history of updates to this API.
  • Returns a list of all NDA numbers.
  • The base URI for the web services is: https://dailymed.nlm.nih.gov/dailymed/services/
  • The web service is versioned, and the version number must be included after the base URI. Currently the latest resources are version v2.
  • The service can return data in XML or JSON format. You can specify which format by appending the appropriate extension (.xml or .json) to the URI.
  • The web service only supports the HTTP method GET, since the web service function is to retrieve data from DailyMed.
  • Each resource may have a number of optional query parameters to filter or control output. These parameters will be detailed under each resource.

Resources

The following table lists all currently available resources. Note that the base URI and file extensions are omitted from the table for readability.

RESTful WEB SERVICE RESOURCES DESCRIPTION
/applicationnumbers Returns a list of all NDA numbers.
/drugclasses Returns a list of all drug classes associated with at least one SPL in the Pharmacologic Class Indexing Files.
/drugnames Returns a list of all drug names.
/ndcs Returns a list of all NDC codes.
/rxcuis Returns a list of all product-level RxCUIs.
/spls Returns a list of all SPLs.
/spls/{SETID} Returns an SPL document for specific SET ID.
/spls/{SETID}/history Returns version history for specific SET ID.
/spls/{SETID}/media Returns links to all media for specific SET ID.
/spls/{SETID}/ndcs Returns all ndcs for specific SET ID.
/spls/{SETID}/packaging Returns all product packaging descriptions for specific SET ID.
/uniis Returns a list of all UNIIs.

Error Codes

Errors are returned using standard HTTP error code syntax. Additional information is included in the response header. The following table lists standard API errors.

CODE DESCRIPTION
404 Not found.
415 Unsupported Media Type.
5xx Server Error.

ZIP & PDF

Latest Version

DailyMed provides URLs to download the latest version of an SPL in ZIP or PDF format. If you do not know the SET ID of the SPL, you can find out by using one of the web services above.

  • https://dailymed.nlm.nih.gov/dailymed/downloadzipfile.cfm?setId={setid} is a URL to download a label as a ZIP file. Additionally, the response header will indicate several pieces of useful information:
    • Content-Disposition: attachment;filename - shows the filename of the ZIP file.
    • X-DAILYMED-LABEL-LAST-UPDATED - shows when the label was last updated.
    • Status Code
      • 200 ACTIVE - the label is currently active.
      • 200 ARCHIVED - the label has been archived.
  • https://dailymed.nlm.nih.gov/dailymed/downloadpdffile.cfm?setId={setid} is a URL to download a label as a PDF file. Additionally, the response header will indicate several pieces of useful information:
    • Content-Disposition: attachment; filename - shows the filename of the PDF file.
    • X-DAILYMED-LABEL-LAST-UPDATED - shows when the label was last updated.
    • Status Code
      • 200 ACTIVE - the label is currently active.
      • 200 ARCHIVED - the label has been archived.

Older Versions

DailyMed also provides URLs to download older version of an SPL in ZIP format. You must know the SET ID as well as the VERSION NUMBER in order to use this function. You can find all the available versions for a specific SET ID through the /spls/{SETID}/history web service.

  • https://dailymed.nlm.nih.gov/dailymed/getFile.cfm?type=zip&setid={setid}&version={versionnumber} is a URL to download any version of a label as a ZIP file.
    • Content-Disposition: attachment; filename - shows the filename of the ZIP file.
    • Status Code
      • 200 OK - the label exists for download.

Older API Documentation

The DailyMed API has been updated to Version 2, which includes new resources and provides improved access to the DailyMed data.
For information about previous versions of API, visit the Previous API Versions page.