• Decrease font size
  • Return font size to normal
  • Increase font size
U.S. Department of Health and Human Services

API Documentation

Overview

FDA’s API employs a Representational State Transfer (REST) interface. This means that method calls are made over the internet by sending HTTP GET or POST requests to the FDA REST server. Nearly any computer language can be used to communicate over HTTP with the REST server. Learn more about REST.

URI Structure

The FDA API uses the following URI structure:

http://tools.fda.gov/CSStorefront/synd.aspx&url=[required parameter]&[optional parameters]

or

http://tools.fda.gov/CSStorefront/feed.aspx?topicid=[optional parameter]&format=[optional parameter]&fromdate=[optional parameter]

A parameter is a value passed on a URL in normal HTTP notation (first one starts with a question mark "?" and any others are separated by the ampersand character "&" e.g. http://pageurl?parameter1=1&parameter2=2 . The complete list of parameters is often referred to as the query string.

Note: In URI examples, italics indicate placeholders for variables or values. Square brackets [ ] are not included in the actual code, it's used as a convention to indicate that you must replace this area of the code with a value or variable.

Back to Top

Feed Request Interface

Overview

With the FDA Feed Request API, you can subscribe to news feeds on FDA topics so you can be alerted when new content is added to a topic that interests you or your organization.

Requesting all topic feed

The feed interface has no required parameters. Calling the feed interface with no parameters returns a feed of the entire catalog.

http://tools.fda.gov/CSStorefront/feed.aspx?topicid=[optional parameter]&format=[optional parameter]&fromdate=[optional parameter]

Retrieving items newer than a specific date

You can also specify a starting date for the feed. This is useful to get only the newest items on the topic. The following example returns items newer than March 1, 2010.

http://tools.fda.gov/CSStorefront/feed.aspx?topicid=[optional parameter]&fromdate=2010-03-01

Specifying a feed format

You can also specify a feed format – atom (Default), rss1, rss2, or sitemap. (Note: the sitemap format is used primarily for web crawlers).

http://tools.fda.gov/CSStorefront/feed.aspx?topicid==[optional parameter]&fromdate==[optional parameter]&format= rss2

Back to Top

Content Request Interface

Overview

With the FDA Syndication API, you can retrieve FDA's vast repository of public health content. An API, or Application Programming Interface, is a way for two computer applications to talk to each other in a common language that they both understand. FDA's API provides a structured way to get FDA content in a predictable, flexible and powerful format.

Required Parameter

The table below details the required parameter for the Content Request REST interface:

Name Code Values Notes
URL url Fully qualified FDA Mini URL in the format http://tools.fda.gov/CSStorefront/[mini URL]. The FDA Mini URL of the desired syndicated content. This is the only required parameter. Learn more about FDA Mini URLs.
CATALOGID CatalogItemId or CID The catalog id of an item as found in a feed. Found in the Id attribute of the catalogitem node in the catalog XML structure.

Optional Parameters

The tables below detail the optional parameters available in the REST interface:

Content Selection Controls

Name Code Values Notes
Registration ID rid Format is typically cs_[nnn]. For example, cs_000 Your unique Registration ID assigned to your organization during registration. The Registration ID is used to track page views and click-through from your site.
Request Class IDs clsids Default value is syndicate A comma delimited list of class IDs to retrieve from the given URL. A class ID is an attribute of an xhtml node normally used to determine the display characteristics of that element in an HTML browser. Used here as a method of selecting content from a source page. E.g. <div class="syndicate"></div>
Request Element IDs elemids Default value is null A comma delimited list of elements to retrieve from the given URL. An element ID is an attribute of an xhtml node normally used to identify the element for use in programming or for convenience. Used here as a method of selecting content from a source page. E.g. <div id="content-main"></div>Note that this parameter overrides class based selections.
Request XPath xpth Default value is null An xpath statement defining what should be retrieved from the URL and returned in the result. XPath is a hierarchical/navigation XML programming tool used for location and selecting XML elements in XML documents. Used here as a method of selecting content from a source XHTML page. Note that this parameter overrides both element and class based selections.

Content Processing Controls

Name Code Values Notes
Strip Scripts noscrpt 1 (default value) or 0 When this value is set to 1 (true), JavaScript is stripped from the results.
Strip Anchors noanch 1 or 0 (default value) When this value is set to 1 (true), anchor tags are stripped from the results, converting links into regular text. An Anchor is a HTML or XHTML element used to hyperlink to another document, or another location on the current document.
Strip Images noimg 1 or 0 (default value) When this value is set to 1 (true), images are stripped from the results.
Strip Comments nocmnt 1 (default value) or 0 When this value is set to 1 (true), comments are stripped from the results.
Strip Inline Styles nostyle 1 (default value) or 0 When this value is set to 1 (true), inline styles are stripped from the results. An inline style is a style that is applied to an HTML or XHTML element as an attribute of that element.

Output Format Control

Name Code Values Notes
JavaScript js 1 (default value) or 0 When this value is set to 1 (true), the results will be returned as JavaScript document.write statements. When it's set to 0 (false), the results are returned as a content fragment. Setting this to true implies that you will be using the client-side (JavaScript) method for consuming content. Learn more about Client-side (JavaScript).
Output Format fmt xhtml (default value) or xml XHTML (Extensible Hypertext Markup Language) is a spinoff of the hypertext markup language (HTML) used for creating Web pages. It is based on the HTML 4.0 syntax, but has been modified to follow the guidelines of XML. XML (EXtensible Markup Language) is open standard for describing data from the W3C. It is used for defining data elements on a Web page and business-to-business documents. XML uses a similar tag structure as HTML; however, whereas HTML defines how elements are displayed, XML defines what those elements contain.
Output Encoding oe UTF-8 (default value) Defines the output format of the syndicated content. E.g. UTF-8, ISO-8859-1
Content Name Space ns Any combination of alpha characters. Default value is null. Used to decorate (prefix) the tags and ids in the results to prevent conflict with existing host page elements. Must contain only upper or lower case letters. An underscore character will be appended by the service.
New Window nw 1 (default value) or 0 When this value is set to 0 (false), links will not open into a new window. When this value is set to 1 (true), links are forcibly updated with target="_blank," which causes links to open into a new window.

Client-side (JavaScript) Methods

FDA provides client-side (JavaScript) method for retrieving syndicated pages. Client-side syndication is typically implemented using JavaScript to retrieve the syndicated content when an end user accesses a syndicated page from their browser. The chart below describes when to use the client-side (JavaScript).

Method Description
Client-side (JavaScript)
  • Easier to implement
  • Syndicated content always current since browser is accessing source content every time
  • May not be compatible when used with CMS or applications
  • Less flexible and less control of content formatting

FDA Mini URL

FDA employs the use of its own URL masking service named FDA Mini URL. This is essentially a database of arbitrary IDs each matched with a destination page. This allows the FDA the flexibility to rename and/or move a destination page without affecting the URLs in the syndication code that you may have downloaded and added to your site. For example, the Mini URL for the page is http://t.fda.gov/CSStorefront/[mini URL]. We highly recommend using the Mini URL instead of using the destination URL of http://tools.fda.gov/CSStorefront/synd.aspx&url=[required parameter]&[optional parameters]

To find the Mini URLs for pages that you’re interested in, add those pages to Syndicate Content on this site. On the Your List page, select the Get Syndication Code button to see the syndication code with the assigned Mini URLs.

Next Steps

Getting the syndication code is very easy using FDA’s Content Syndication site. Simply follow these steps:

  1. Register online to sign up for the service. You will receive a unique Registration ID that FDA uses to track metrics.
  2. Browse the site to find pages you’re interested in syndicating and add those pages to Syndicate Content. You can add as many pages as you’d like.
  3. When you’re finished adding syndicated pages to Syndicate Content, select Your List in the navigation bar and choose Get Syndication Code.
  4. On the Get Syndication Code page, copy or download the code for the selected syndicated pages, follow the online instructions on that page, and add the syndicated code to your site.

Back to Top

-
-