Data Feeds

Fawn publishes routinely updated data feeds over HTTP in several useful formats (mainly CSV, JSON, and XHTML1.0). The following links describe these feeds and how to access them.

Today
all available obs for a station for the current date (or last 24 hrs)
Week
all available obs for a station for 7 days prior to the current date (designed to complement the "today" feed above)
Last Day
aggregate summary data of the most recent complete day available
Last Hour
aggregate summary data of the most recent complete hour available

If you have questions about these feeds, please contact us.

JSONP (for Javascript Developers)

Along with raw JSON, the feeds above implement the JSONP convention to allow cross-domain use in Javascript apps.

Simply append ?jsonp=yourCallbackFunc to the JSON feed URL. Your callback function name can be up to 32 alphanumeric (& underscore) characters.

The example code below queries the "Today" feed for the latest Alachua observation using jQuery. The function fawnDate can convert FAWN's ISO8601 dates into native Date objects.

$(function () {
    $.getJSON(
        'http://fawn.ifas.ufl.edu/controller.php/today/obs/260;json?jsonp=?'
        ,function (data) {
            var latestOb = data[0] // latest ob is first element of array
                ,time = fawnDate(latestOb.endTime)
                ,temp = latestOb.t2m + " deg C";
            alert("At " + time + " the temp was " + temp + ".");
        }
    );
    
    // parse a FAWN time (subset of ISO8601)
    function fawnDate(str) {
        var m = str.match(/^(\d+)-(\d+)-(\d+)T(\d+):(\d+):00\-0(\d)/);
        for (var i = 2; i <= 6; i++)
            m[i] = parseInt(m[i], 10);
        return new Date(
            Date.UTC(m[1], m[2] - 1, m[3], m[4], m[5], 0, 0) + (m[6] * 3600000)
        );
    }
});