What Is an Application Programming Interface (API)?
- An API is a method to open up and allow access to specific content or functionality
from within an
application. An API allows other developers or organizations the ability to use
specific functionality,
usually to build or produce new functionality. An API has specific rules and requirements
that allow
users to properly access the content or functionality.
- To learn more, visit:
How To Use the healthfinder.gov API
- The API will provide the latest version of the healthfinder.gov content in English and Spanish.
- The API requires an access key. To obtain an access key, please register to create an account.
- The API can be accessed on an as needed basis and is not limited in how frequently
it can be accessed. However, some safeguards will lock out a query request, if there
are too many requests in a specific amount of time. The healthfinder.gov feed is
provided in XML and JSON formats.
Examples of healthfinder.gov API:
- The query below returns all of the topics and tools in the English database by using an * (asterisk) for keyword, which indicates "return
all."
http://healthfinder.gov/developers/Search.xml?api_key=demo_api_key&keyword=*
- The query below returns all of the topics and tools in the Spanish database by using an * (asterisk) for keyword, which indicates "return
all."
http://healthfinder.gov/developers/Search.xml?api_key=demo_api_key&keyword=*&lang=es
- The query below searches across all English topics and tools that contain the word
"diabetes."
http://healthfinder.gov/developers/Search.xml?api_key=demo_api_key&keyword=diabetes
- The query below searches across all Spanish topics and tools that contain the word
"mammograms."
http://healthfinder.gov/developers/Search.xml?api_key=demo_api_key&keyword=mammograms&lang=es
- This query returns the contents of the English Category with an ID of 1, which is
"Nutrition and Fitness"
http://healthfinder.gov/developers/Search.xml?api_key=demo_api_key&CategoryID=1
- This query returns the contents of the Spanish Category with an ID of 11, which
is "Para mujeres"
http://healthfinder.gov/developers/Search.xml?api_key=demo_api_key&CategoryID=11&lang=es
- This query returns the contents of the English topic with an ID of 10, which is
"Talk With Your Doctor About Taking Aspirin Every Day."
http://healthfinder.gov/developers/Search.xml?api_key=demo_api_key&TopicID=10
- This query returns the contents of the Spanish topic with an ID of 9, which is "Hazte
la prueba del cáncer de seno"
http://healthfinder.gov/developers/Search.xml?api_key=demo_api_key&topicID=9&lang=es
- This query returns the contents of the topic with an ID of 10 and 12, which is "Talk
With Your Doctor About Taking Aspirin Every Day" and "Get a Bone Density Test."
http://healthfinder.gov/developers/Search.xml?api_key=demo_api_key&TopicID=10,12
- This query returns the contents of the topic with an ID of 14 and 15, which is "Hazte
la prueba del colesterol" and "Hazte las pruebas del cáncer de colon y de recto."
http://healthfinder.gov/developers/Search.xml?api_key=demo_api_key&topicID=14,15&lang=es
- This query returns the contents of the tool with an ID of 10, which is "Losing Weight:
Conversation Starters."
http://healthfinder.gov/developers/Search.xml?api_key=demo_api_key&toolID=10
- This query returns the contents of the tool with an ID of 12, which is "Mammograms."
http://healthfinder.gov/developers/Search.xml?api_key=demo_api_key&toolID=12&lang=es
- This query returns the contents of the tool as a JSON feed with an ID of 10, which
is "Losing Weight: Conversation Starters."
http://healthfinder.gov/developers/Search.json?api_key=demo_api_key&topicID=10
- This query returns the contents of the tool as a JSON feed with an ID of 10, which
is "Hazte la prueba para medir la fuerza de tus huesos."
http://healthfinder.gov/developers/Search.json?api_key=demo_api_key&topicID=12&lang=es
API Parameters
Required Parameter: The API cannot be used without a valid ID code
that links to a registered account in the system.
- api_key = The unique ID for each registered organization using
the site
Spanish Parameter:To access Spanish content in the API append the
following parameter to the end of the query string
- Please Note:There is not a 'one to one' corresponding English to
Spanish content between keywords, Categories, Topics, and Tools. Unfortunately,
the following parameter cannot just be added to the end of an English query and
generate the same exact query in Spanish.
- lang = es: will query the Spanish version of the Health Topic
Primary Parameters: At least one of these parameters must be included
in the API for it to function correctly.
- All Topics and Tools = To return all of the topics and tools (everything)
in the system, use the following code.
- Keyword = Also known as content or keyphrases. When this parameter
is used, the system is expecting at least one or multiple words to use to query
the database. To search using multiple keywords, enter a space between each term.
- CategoryID = The API is expecting a number value that matches one
of the Category IDs in the database. When Category is used, all of the topics within
the category will be returned.
- TopicID = The API is expecting a number value that matches one
of the Topic IDs in the database.
- ToolID = The API is expecting a number value that matches one of
the Tool IDs in the database.
- callback = This parameter sets the callback function for json requests.
It allows cross-domain ajax request to be made.