All API access is over http and starts with:
http://data.nasa.gov/api/
The standard response format is JSON. Here’s an example of what a request for the Great Images in NASA dataset would look like:
GRIN is a collection of over a thousand images of significant historical interest scanned at high-resolution in several sizes. This collection is intended for the media, publishers, and the general public looking for high-quality photographs.<\/p>\n",{
"status": "ok",
"post": {
"id": 619,
"slug": "great-images-in-nasa",
"url": "http:\/\/data.nasa.gov\/great-images-in-nasa\/",
"title": "Great Images in NASA",
"title_plain": "Great Images in NASA",
"content": "
"excerpt": "GRIN is a collection of over a thousand images of significant historical interest scanned at high-resolution in several sizes. This collection is intended for the media, publishers, and the general public looking for high-quality photographs.",
"date": "2011-09-19 06:26:13",
"modified": "2011-09-19 06:26:13",
"categories": [
{
"id": 322,
"slug": "catalog",
"title": "Catalog",
"description": "#8485FF",
"parent": 0,
"post_count": 9
},
{
"id": 177,
"slug": "institutional",
"title": "Institutional",
"description": "#DC282F",
"parent": 0,
"post_count": 6
},
{
"id": 176,
"slug": "operations",
"title": "Operations",
"description": "#FF4F00",
"parent": 0,
"post_count": 4
}
],
"tags": [
{
"id": 186,
"slug": "apollo",
"title": "Apollo",
"description": "",
"post_count": 10
},
{
"id": 408,
"slug": "gemini",
"title": "gemini",
"description": "",
"post_count": 1
},
{
"id": 404,
"slug": "grin",
"title": "grin",
"description": "",
"post_count": 1
},
{
"id": 406,
"slug": "history",
"title": "history",
"description": "",
"post_count": 1
},
{
"id": 377,
"slug": "mercury",
"title": "mercury",
"description": "",
"post_count": 5
},
{
"id": 407,
"slug": "nasa",
"title": "nasa",
"description": "",
"post_count": 1
},
{
"id": 405,
"slug": "photography",
"title": "photography",
"description": "",
"post_count": 1
}
],
"custom_fields": {
"acronym": [
"GRIN"
],
"more_info_link": [
"http:\/\/grin.hq.nasa.gov\/"
],
"datagov_id": [
""
],
"curator_person_name": [
"Steve Garber"
],
"curator_person_email": [
""
],
"curator_url": [
"http:\/\/history.nasa.gov\/"
],
"curator_center": [
"NASA Headquarters"
],
"curator_org_name": [
"NASA History Office"
]
}
},
"previous_url": "http:\/\/data.nasa.gov\/precipitation-measurement-missions-data-access\/",
"next_url": "http:\/\/data.nasa.gov\/nasa-earth-exchange\/"
}
Functions
There are 10 different functions available through the API:
get_recent_datasets
get_dataset
get_date_datasets
get_category_datasets
get_tag_datasets
get_search_results
get_date_index
get_category_index
get_tag_index
get_recent_datasets
Provides a list of the ten (by default) most recent datasets posted to the site.
Required Arguments
None
Option Arguments
count
– defines how many datasets to return (default is 10)
Example
Return the 15 most recent datasets
http://data.nasa.gov/api/get_recent_datasets?count=15
get_dataset
Returns a single dataset
Required Arguments
One of the following is required:
id
– set to the dataset’s ID
slug
– set to the dataset’s slug
Option Arguments
none
Example
Returns the dataset with the ID 619
http://data.nasa.gov/api/get_dataset?id=619
Returns the dataset with the slug great-images-in-nasa
http://data.nasa.gov/api/get_dataset?slug=great-images-in-nasa
get_date_datasets
Returns an array of datasets in a specific date archive (by day, month, or year).
Required Arguments
data
– set to a date in the format YYYY or YYYY-MM or YYYY-MM-DD (non-numeric characters are stripped from the var, so YYYYMMDD or YYYY/MM/DD are also valid)
Option Arguments
count
– defines how many datasets to return (default is 10)
Example
Return all datasets added in October 2011
http://data.nasa.gov/api/get_date_datasets/?date=2011-10
get_category_datasets
Returns an array of datasets in a specific category.
Required Arguments
One of the following is required:
id
– set to the category’s ID
slug
– set to the category’s slug
Option Arguments
count
– defines how many datasets to return (default is 10)
Example
Return all datasets in the “Earth Science” category
http://data.nasa.gov/api/get_category_datasets/?slug=earth-science
get_tag_datasets
Returns an array of datasets with a specific tag.
Required Arguments
One of the following is required:
id
– set to the tag’s ID
slug
– set to the tag’s slug
Option Arguments
count
– defines how many datasets to return (default is 10)
Example
Return all datasets tagged with “apollo” and “imagery”
http://data.nasa.gov/api/get_tag_datasets/?slug=apollo&slug=imagery
get_search_results
Returns an array of datasets in response to a search query.
Required Arguments
search
– set to the desired search query
Option Arguments
count
– defines how many datasets to return (default is 10)
Example
Return results for “carbon cycle”
http://data.nasa.gov/api/get_search_results/?search=carbon+cycle
get_date_index
Returns both an array of date permalinks and a tree structure representation of the archive.
Required Arguments
None
Option Arguments
None
Example
Return date permalinks and tree structure
http://data.nasa.gov/api/get_date_index/
get_category_index
Returns an array of active categories.
Required Arguments
None
Option Arguments
None
Example
Return array of categories
http://data.nasa.gov/api/get_category_index/
get_recent_datasets
Returns an array of active tags.
Required Arguments
None
Option Arguments
none
Example
Return array of tags
http://data.nasa.gov/api/get_tag_index/
Additional Usage
By adding dev=1
to a request, you can view it in a structured, easy-to-read mode.
Special thanks to the creators of the JSON-API WordPress Plugin, off which our data API was created.