1. Select Location
°N
Number - The latitude of the requested location (North). Also supported: latitude, y
°E
Number - The longitude of the requested location (East). Also supported: longitude, x
String - The 5-digit zip code of the location. Note that USPS zip code areas do not
align precisely with Census geographies, so when high accuracy is required it is
recommended to use latitude and longitude. Specified as a string because certain zip
codes begin with zeroes.
String - The 2-letter USPS state code. It will be converted into the latitude and longitude of that state's capital.
Object - Represents the address of the requested location.
Name | Lat (N) | Lng (E) |
---|---|---|
Washington DC | 38.9047 | -77.0164 |
Seattle | 47.6097 | -122.3331 |
Honolulu | 21.3000 | -157.8167 |
Miami | 25.7753 | -80.2089 |
Houston | 29.7604 | -95.3698 |
2. Submit
Get the Data
The Returned Data
<script>
var sdk = new CitySDK();
var farmersMarkets = sdk.modules.farmersMarket;
var request = {};
farmersMarkets.APIRequest(request, function (response) {
jQuery("#rawOutput").text(JSON.stringify(response));
jQuery('#output').empty();
if (response.results[0]['id'] != "Error") {
jQuery('#output').append("<table><tr><th>Market</th><th>Details</th></tr><tbody></tbody></table>");
for (var i = 0; i < response.results.length; i++) {
jQuery('#output table tbody').append("<tr><td>" +
response.results[i].marketname + '</td><td class="centeredCellButton
details-link"><input type="submit" class="btn btn-xs
btn-primary" value="View Details" onclick="details(' +
response.results[i].id + ',\'' +
String(response.results[i].marketname).replace(/(['"])/g, "\\$1") +
'\')"></td></tr>');
}
} else {
jQuery('#output').append('<br/><div class="alert alert-warning"
role="alert"><strong>No Data.</strong> There are no farmers
markets matching the requested location.</div>');
}
});
</script>