Api is up and running

How to migrate from our v.2 API to our brand new v.3 API

Hi folks,

Here’s some guidance on how to migrate from our v.2 API, to our brand new v.3 API. Below are example requests for each endpoint that you would have made in v.2, and then what that API request would look like in v.3. If you look through the following examples, you’ll see that a lot remains the same; though some calls have changed from a POST to a GET method, the fields are mostly the same, and requests to different endpoints in v.3 are nearly identical to one another.

Endpoints With Changes

1. Historical
2. Realtime
3. Nowcast
4. Hourly
5. Daily

 

Historical

Updates
1. POST changed to GET
2. Request details were part of JSON request body in v.2; in v.3 they are query parameters
3. There are TWO historical endpoints in v.3 – one for historical station data, and one for proprietary ClimaCell data

v.2 Request Example
POST https://api2.climacell.co/v2/historical
Headers:
apikey:<your-key>
Request Body:
{ “geocode”: { “lon”: -71.1760, “lat”: 42.3026 }, “start_time”: “2018-07-01T12:00:00Z”, “end_time”: “2018-07-01T18:00:00Z”, “timestep”: 60, “fields”: [ { “name”: “temp”, “units”: “F” }, { “name”: “humidity”, “units”: “%” } ] }

v.3 Request Example
GET https://api.climacell.co/v3/weather/historical/station?lat=42.3026&lon=-71.1760&start_time=2018-07-01T12:00:00Z&end_time=2018-07-01T18:00:00Z&timestep=60&fields=temp:F,humidity:%
Headers:
apikey:<your-key>

 

Realtime

Updates
1. POST changed to GET
2. Request details were part of JSON request body in v.2; in v.3 they are query parameters

v.2 Request Example
POST https://api2.climacell.co/v2/realtime
Headers: apikey:<your-key>
Request Body:
{ “geocode”: { “lon”: -71.1760, “lat”: 42.3026 }, “start_time”: “2018-07-01T12:00:00Z”, “end_time”: “2018-07-01T18:00:00Z”, “fields”: [ { “name”: “temp”, “units”: “F” }, { “name”: “humidity”, “units”: “%” } ] }

v.3 Request Example
GET https://api.climacell.co/v3/weather/realtime?lat=42.3026&lon=-71.1760&start_time=2018-07-01T12:00:00Z&end_time=2018-07-01T18:00:00Z&fields=temp:F,humidity:%
Headers: apikey:<your-key>

 

Nowcast

Updates
1. POST changed to GET
2. Request details were part of JSON request body in v.2; in v.3 they are query parameters

v.2 Request Example
POST https://api2.climacell.co/v2/nowcast
Headers:
apikey:<your-key>
Request Body:
{ “geocode”: { “lon”: -71.1760, “lat”: 42.3026 }, “start_time”: “2018-07-01T12:00:00Z”, “end_time”: “2018-07-01T18:00:00Z”, “timestep”: 60, “fields”: [ { “name”: “temp”, “units”: “F” }, { “name”: “humidity”, “units”: “%” } ] }

v.3 Request Example
GET https://api.climacell.co/v3/weather/nowcast?lat=42.3026&lon=-71.1760&start_time=2018-07-01T12:00:00Z&end_time=2018-07-01T18:00:00Z&timestep=60&fields=temp:F,humidity:%
Headers:
apikey:<your-key>

 

Hourly

Updates
1. Units are collapsed with weather fields, so that units are provided after a colon for the field query parameter
2. num_hours is replaced with start_time and end_time in v.3

v.2 Request Example
GET https://api2.climacell.co/v2/weather/forecast/hourly?lat=42.302&lon=-71.176&num_hours=6&fields=temp,feels_like&units=temp:F;feels_like:F
Headers:
apikey:<your-key>

v.3 Request Example
GET https://api.climacell.co/v3/weather/hourly?lat=42.3026&lon=-71.1760&start_time=2018-07-01T12:00:00Z&end_time=2018-07-01T18:00:00Z&fields=temp:F,humidity:%
Headers:
apikey:<your-key>

 

Daily

Updates
1. Units are collapsed with weather fields, so that units are provided after a colon for the field query parameter
2. num_days is replaced with start_time and end_time in v.3

v.2 Request Example
GET https://api2.climacell.co/v2/weather/forecast/daily?lat=42.302&lon=-71.176&num_days=6&fields=temp,feels_like&units=temp:F;feels_like:F
Headers:
apikey:<your-key>

v.3 Request Example
GET https://api.climacell.co/v3/weather/daily?lat=42.3026&lon=-71.1760&start_time=2018-07-01T12:00:00Z&end_time=2018-07-01T18:00:00Z&fields=temp:F,humidity:%
Headers:
apikey:<your-key>