0

I'm a beginner with APIs but I feel this one is still a bit more vast and complex.

I want to find the air temperature of Boston. Or really, output any useful weather data.

Using this URL in JSON I can find the location of Boston: http://www.ncdc.noaa.gov/cdo-web/api/v2/locations/CITY:US250002

Response:

{"mindate":"1885-01-01","maxdate":"2015-07-25","name":"Boston, MA US","datacoverage":1,"id":"CITY:US250002"}

Using this I can find the data category of "Air Temperature": http://www.ncdc.noaa.gov/cdo-web/api/v2/datacategories/TEMP

Response:

{"name":"Air Temperature","id":"TEMP"}

This gives me no helpful information, so here is my effort to combine the two: http://www.ncdc.noaa.gov/cdo-web/api/v2/datacategories/TEMP?locationid=CITY:US250002 (Air Temperature in Boston)

Response:

{"name":"Air Temperature","id":"TEMP"}

Normally when I enter an API all the information is there and available to filter via parameters. Here it seems the data is all divided. It will show you all the locations, all the data sets, all the categories that exist in the API, but how do I see the actual meat of the data? Ex. Current water temperature of Chicago, IL? Air Temperature on 3/14/2014 in Los Angeles, CA?

Here's my jsfiddle I'm using: http://jsfiddle.net/f98dauaz/1/

user3521314
  • 464
  • 6
  • 14

1 Answers1

0

You need to use a different endpoint, that endpoint I believe is just used for locations if you are looking for a location and data on that location itself.

You would need to pull from the data endpoint instead of the location endpoint, which you can find info on here http://www.ncdc.noaa.gov/cdo-web/webservices/v2#data

an example would be: http://www.ncdc.noaa.gov/cdo-web/api/v2/data?datasetid=GHCND&datatypeid=TMAX&datatypeid=TMIN&locationid=ZIP:(zip_code_here)&limit=(your_data_limit_for_file)&startdate=(YYYY-MM-DD)&enddate=(YYYY-MM-DD)

Note this is for historical data not for current data

Strainger
  • 134
  • 1
  • 5