NOAA   The NOAA GEO-IDE UAF ERDDAP
Easier access to all of NOAA's data
   
Brought to you by NOAA NMFS SWFSC ERD    

ERDDAP > RESTful Web Services

Accessing ERDDAP's RESTful Web Services

ERDDAP is both:
  • A web application – a web site that humans with browsers can use (in this case, to get data, graphs, and information about datasets).
     
  • A RESTful web service – a web site that computer programs can use (in this case, to get data, graphs, and information about datasets).
For every ERDDAP feature that you as a human with a browser can use, there is an
almost identical feature that is designed to be easy for computer programs to use. For example, humans can use this URL to do a Full Text Search for interesting datasets:
http://upwell.pfeg.noaa.gov/erddap/search/index.html?page=1&itemsPerPage=1000&searchFor=temperature
By changing the file extension in the URL from .html to .json:
http://upwell.pfeg.noaa.gov/erddap/search/index.json?page=1&itemsPerPage=1000&searchFor=temperature
we get a URL that a computer program or JavaScript script can use to get the same information in a more computer-program-friendly format like JSON.

Build Things on Top of ERDDAP
There are many features in ERDDAP that can be used by computer programs or scripts that you write. You can use them to build other web applications or web services on top of ERDDAP, making ERDDAP do most of the work! So if you have an idea for a better interface to the data that ERDDAP serves or a web page that needs an easy way to access data, we encourage you to build your own web web application, web service, or web page and use ERDDAP as the foundation. Your system can get data, graphs, and other information from ERD's ERDDAP or from other ERDDAP installations, or you can set up your own ERDDAP server, which can be publicly accessible or just privately accessible.

RESTful URL Requests
Requests for user-interface information from ERDDAP (for example, search results) use the web's universal standard for requests: URLs sent via HTTP GET. This is the same mechanism that your browser uses when you fill out a form on a web page and click on Submit. To use HTTP GET, you generate a specially formed URL (which may include a query) and send it with HTTP GET. You can form these URLs by hand and enter them in the address textfield of your browser (for example,
http://upwell.pfeg.noaa.gov/erddap/search/index.json?page=1&itemsPerPage=1000&searchFor=temperature)
Or, you can write a computer program or web page script to create a URL, send it, and get the response. URLs via HTTP GET were chosen because

  • They are simple to use.
  • They work.
  • They are universally supported (in browsers, computer languages, operating system tools, etc).
  • They are a foundation of Representational State Transfer (REST) and Resource Oriented Architecture (ROA).
  • They facilitate using the World Wide Web as a big distributed application, for example via mashups and AJAX applications.
  • They are stateless, as is ERDDAP, which makes the system simpler.
  • A URL completely define a given request, so you can bookmark it in your browser, write it in your notes, email it to a friend, etc.

Percent Encoding
In URLs, some characters are not allowed (for example, spaces) and other characters have special meanings (for example, '&' separates key=value pairs in a query). When you fill out a form on a web page and click on Submit, your browser automatically percent encodes the special characters in the URL (for example, by replacing ' ' in a query value with "%20", for example,
http://upwell.pfeg.noaa.gov/erddap/search/index.html?page=1&itemsPerPage=1000&searchFor=temperature%20wind%20speed
But if your computer program or script generates the URLs, it may need to do the percent encoding itself. Programming languages have tools to do this (for example, see Java's java.net.URLEncoder).

Requesting Compressed Files
ERDDAP doesn't offer results stored in compressed (e.g., .zip or .gzip) files.
Instead, ERDDAP looks for accept-encoding in the HTTP GET request header sent
by the client. If a supported compression type ("gzip", "x-gzip", or "deflate") is found
in the accept-encoding list, ERDDAP includes "content-encoding" in the HTTP response
header and compresses the data as it transmits it.
It is up to the client program to look for "content-encoding" and decompress the data.
Browsers and OPeNDAP clients do this by default. They request compressed data and
decompress the returned data automatically.
Other clients (e.g., Java programs) have to do this explicitly.

Response File Types
Although humans using browsers want to receive user-interface results (for example, search results) as HTML documents, computer programs often prefer to get results in simple, easily parsed, less verbose documents. ERDDAP can return user-interface results as a table of data in these common, computer-program friendly, file types:

  • .csv - a comma-separated ASCII text table. (more info)
  • .htmlTable - an .html web page with the data in a table. (more info)
  • .json - a table-like JSON file. (more info)
  • .mat - a MATLAB binary file. (more info)
  • .nc - a flat, table-like, NetCDF-3 binary file. (more info)
  • .tsv - a tab-separated ASCII text table. (more info)
  • .xhtml - an XHTML (XML) file with the data in a table. (more info)
In every results table:
  • Each column has a column name and one type of information.
  • The first row of the table has the column names.
  • Subsequent rows have the information you requested.

The content in these plain file types is also slightly different from the .html response -- it is intentionally bare-boned, so that it is easier for a computer program to work with.

A Consistent Data Structure for the Responses
All of the user-interface services described on this page can return a table of data in any of the common file formats listed above. Hopefully, you can write just one procedure to parse a table of data in one of the formats. Then you can re-use that procedure to parse the response from any of these services. This should make it easier to deal with ERDDAP.

.csv and .tsv Details

  • If a datum in a .csv file has internal double quotes or commas, ERDDAP follows the .csv specification strictly: it puts double quotes around the datum and doubles the internal double quotes.
  • If a datum in a .csv or .tsv file has internal newline characters, ERDDAP converts the newline characters to character #166 (¦). This is non-standard.

jsonp
Requests for .json files may now include an optional jsonp request by adding "&.jsonp=functionName" to the end of the query. Basically, this tells ERDDAP to add "functionName(" to the beginning of the response and ")" to the end of the response. If originally there was no query, leave off the "&" in your query.

griddap and tabledap Offer Different File Types
The file types listed above are file types ERDDAP can use to respond to user-interface types of requests (for example, search requests). ERDDAP supports a different set of file types for scientific data (for example, satellite and buoy data) requests (see the griddap and tabledap documentation.

Access URLs for ERDDAP's Services
ERDDAP has these URL access points for computer programs:

If you have suggestions for additional links, contact bob dot simons at noaa dot gov.

Using ERDDAP as a Data Source within Your Java Program

As described above, since Java programs can access data available on the web, you can write a Java program that accesses data from any publicly accessible ERDDAP installation.

Or, since ERDDAP is an all-open source program, you can also set up your own copy of ERDDAP on your own server (publicly accessible or not) to serve your own data. Your Java programs can get data from that copy of ERDDAP. See Set Up Your Own ERDDAP.

ERDDAP Version

If you want to use a new feature on a remote ERDDAP, you can find out if the new feature is available by sending a request to determine the ERDDAP's version number, for example,
http://upwell.pfeg.noaa.gov/erddap/version
ERDDAP will send a text response with the ERDDAP version number of that ERDDAP. For example: ERDDAP_version=1.42
If you get an HTTP 404 Not-Found error message, treat the ERDDAP as version 1.22 or lower.

 
ERDDAP, Version 1.42
Disclaimers | Privacy Policy | Contact