Introduction
Climate API key is a way to get the real time climate reports of any place of the world. You can use this API key free of cost in your ASP.NET MVC Application. To use Climate API, you have to register and get your own API key from here.
The link reference is - https://home.openweathermap.org/users/sign_up
Description
In this Application, you can put your required city name inside the country and outside the country along with city ID, followed by using climate API. You will get the details of climate information.
Refer
You can use this URL to get the City ID, Country name and Code.
http://openweathermap.org/help/city_list.txt
You should use the URL given below to pass the CITYID and APIKEY.
http://api.openweathermap.org/data/2.5/weather?id=" + cities + "&appid=" + apiKey + "&units=metric
Steps to create MVC app, using climate API shows the detailed climate Information
Step 1
Create an Empty Template in an ASP.NET MVC app named “ClimateReport”.
Step 2
Create one model class file named “ClimateModel.cs”.
Code Ref
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.ComponentModel.DataAnnotations;
-
- namespace ClimateReport.Models
- {
- public class ClimateModel
- {
- public string apiResponse { get; set; }
-
- public Dictionary<string, string> cities
- {
- get;
- set;
- }
- }
- }
Code description
Here, I added one namespace for support attribute on the code.
using System.ComponentModel.DataAnnotations;
This model class file has 2 properties, which are given below.
The string property i.e. apiResponse will contain an API response. I can serialize the response JSON and convert it to HTML in the Controller before setting this in this string property i.e. apiResponse.
In the dictionary property, I can add the City Names and their ID's.
Step 3
Here, I added one New folder and Helper Class is named as "Class” & “ClimateApi.cs”.
Code Ref
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
-
- namespace ClimateReport.Class
- {
- public class ClimateApi
- {
- }
- public class Coord
- {
- public double lon { get; set; }
- public double lat { get; set; }
- }
- public class Weather
- {
- public int id { get; set; }
- public string main { get; set; }
- public string description { get; set; }
- public string icon { get; set; }
- }
- public class Main
- {
- public double temp { get; set; }
- public int pressure { get; set; }
- public int humidity { get; set; }
- public int temp_min { get; set; }
- public int temp_max { get; set; }
- }
- public class Wind
- {
- public double speed { get; set; }
- public int deg { get; set; }
- }
- public class Clouds
- {
- public int all { get; set; }
- }
- public class Sys
- {
- public int type { get; set; }
- public int id { get; set; }
- public double message { get; set; }
- public string country { get; set; }
- public int sunrise { get; set; }
- public int sunset { get; set; }
- }
- public class ResponseWeather
- {
- public Coord coord { get; set; }
- public List<Weather> weather { get; set; }
- public string @base { get; set; }
- public Main main { get; set; }
- public int visibility { get; set; }
- public Wind wind { get; set; }
- public Clouds clouds { get; set; }
- public int dt { get; set; }
- public Sys sys { get; set; }
- public int id { get; set; }
- public string name { get; set; }
- public int cod { get; set; }
- }
- }
Code description
Here, I have added some classes and put some public access properties inside it. Using this class and properties, we can access the climate information, using an API. It will work like IntelliSense.
For example
- public class Main
- {
- public double temp { get; set; }
- public int pressure { get; set; }
- public int humidity { get; set; }
- public int temp_min { get; set; }
- public int temp_max { get; set; }
- }
Here, I added one class name called “Main”. Inside Main class, I added some properties called pressure, humidity, temp_min , temp_max and they can be used publicly.
Like this, we can add other class and related public access properties.
Now, we can create one parent class named ResponseWeather.
Inside this parent class, I added predefined base classes and its objects with get and set properties.
For example
- public Main main { get; set; }
Like this, we can add predefined base classes and its objects with get and set properties.
Inside parent class also, we added some public variables.
For example
- public int id { get; set; }
- public int cod { get; set; }
Trick to Create these classes
The purpose of those classes is to serialize JSON response You are creating these classes for a JSON, which is a very hard and tedious job. Using an online tool json2csharp, I made these classes very easily. You can use this tool to create these classes for any JSON, which you have. All you have to do is to add your JSON and click Generate button.
My JSON code is for these classes.
- {"coord":{"lon":139,"lat":35},
- "sys":{"country":"JP","sunrise":1369769524,"sunset":1369821049},
- "weather":[{"id":804,"main":"clouds","description":"overcast clouds","icon":"04n"}],
- "main":{"temp":289.5,"humidity":89,"pressure":1013,"temp_min":287.04,"temp_max":292.04},
- "wind":{"speed":7.31,"deg":187.002},
- "rain":{"3h":0},
- "clouds":{"all":92},
- "dt":1369824698,
- "id":1851632,
- "name":"Shuzenji",
- "cod":200}
My generated C# code is based on the above mentioned My JSON code.
- public class Coord
- {
- public int lon { get; set; }
- public int lat { get; set; }
- }
- public class Sys
- {
- public string country { get; set; }
- public int sunrise { get; set; }
- public int sunset { get; set; }
- }
- public class Weather
- {
- public int id { get; set; }
- public string main { get; set; }
- public string description { get; set; }
- public string icon { get; set; }
- }
- public class Main
- {
- public double temp { get; set; }
- public int humidity { get; set; }
- public int pressure { get; set; }
- public double temp_min { get; set; }
- public double temp_max { get; set; }
- }
- public class Wind
- {
- public double speed { get; set; }
- public double deg { get; set; }
- }
- public class Rain
- {
- public int __invalid_name__3h { get; set; }
- }
- public class Clouds
- {
- public int all { get; set; }
- }
- public class RootObject
- {
- public Coord coord { get; set; }
- public Sys sys { get; set; }
- public List<Weather> weather { get; set; }
- public Main main { get; set; }
- public Wind wind { get; set; }
- public Rain rain { get; set; }
- public Clouds clouds { get; set; }
- public int dt { get; set; }
- public int id { get; set; }
- public string name { get; set; }
- public int cod { get; set; }
- }
Source To Create, using http://json2csharp.com online tool.
Step 4
Now, I have added one Controller class file named “ClimateMapController.cs”.
Code Ref
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using System.Net;
- using System.IO;
- using System.Text;
- using Newtonsoft.Json;
- using ClimateReport.Class;
- using ClimateReport.Models;
-
- namespace ClimateReport.Controllers
- {
- public class ClimateMapController : Controller
- {
-
- public ActionResult Index()
- {
- ClimateModel openWeatherMap = FillCity();
- return View(openWeatherMap);
- }
-
- [HttpPost]
- public ActionResult Index(string cities)
- {
- ClimateModel openWeatherMap = FillCity();
-
- if (cities != null)
- {
-
- string apiKey = "Put Your Own Api Key";
- HttpWebRequest apiRequest = WebRequest.Create("http://api.openweathermap.org/data/2.5/weather?id=" + cities + "&appid=" + apiKey + "&units=metric") as HttpWebRequest;
-
- string apiResponse = "";
- using (HttpWebResponse response = apiRequest.GetResponse() as HttpWebResponse)
- {
- StreamReader reader = new StreamReader(response.GetResponseStream());
- apiResponse = reader.ReadToEnd();
- }
-
- ResponseWeather rootObject = JsonConvert.DeserializeObject<ResponseWeather>(apiResponse);
-
- StringBuilder sb = new StringBuilder();
- sb.Append("<table><tr><th>Weather Description</th></tr>");
- sb.Append("<tr><td>City:</td><td>" + rootObject.name + "</td></tr>");
- sb.Append("<tr><td>Country:</td><td>" + rootObject.sys.country + "</td></tr>");
- sb.Append("<tr><td>Country Sun Rise:</td><td>" + rootObject.sys.sunrise + "</td></tr>");
- sb.Append("<tr><td>Country Sun Sete:</td><td>" + rootObject.sys.sunset + "</td></tr>");
- sb.Append("<tr><td>Wind:</td><td>" + rootObject.wind.speed + " Km/h</td></tr>");
- sb.Append("<tr><td>Current Temperature:</td><td>" + rootObject.main.temp + " °C</td></tr>");
- sb.Append("<tr><td>Max. Temperature:</td><td>" + rootObject.main.temp_max + " °C</td></tr>");
- sb.Append("<tr><td>Min. Temperature:</td><td>" + rootObject.main.temp_min + " °C</td></tr>");
- sb.Append("<tr><td>Pressure:</td><td>" + rootObject.main.pressure + "</td></tr>");
- sb.Append("<tr><td>Humidity:</td><td>" + rootObject.main.humidity + "</td></tr>");
- sb.Append("<tr><td>Weather:</td><td>" + rootObject.weather[0].description + "</td></tr>");
- sb.Append("</table>");
- openWeatherMap.apiResponse = sb.ToString();
- }
- else
- {
- if (Request.Form["submit"] != null)
- {
- TempData["SelectOption"] = -1;
- }
- }
- return View(openWeatherMap);
- }
-
- public ClimateModel FillCity()
- {
- ClimateModel openWeatherMap = new ClimateModel();
- openWeatherMap.cities = new Dictionary<string, string>();
- openWeatherMap.cities.Add("Mumbai", "1275339");
- openWeatherMap.cities.Add("New Delhi", "1261481");
- openWeatherMap.cities.Add("Bangalore", "1277333");
- openWeatherMap.cities.Add("Bhubaneshwar", "1275817");
- openWeatherMap.cities.Add("Khurda", "1266616");
- openWeatherMap.cities.Add("Cuttack", "1273780");
- openWeatherMap.cities.Add("Hyderabad", "1269843");
- openWeatherMap.cities.Add("Philadelphia", "4560349");
- return openWeatherMap;
- }
-
- }
- }
Code description
Here, I added one namespace and assembly/dll file to access the system generated class of the predefined class files to support API related matter.
The other two namespaces to access and inherit the properties and roles are given below.
- using ClimateReport.Class;
- using ClimateReport.Models;
In an Index action result method of HttpGet attribute, I added my model class file. I created one function called FillCity() and assign to ClimateModel class object.
Get ActionResult Index will be called, whenever the Index view will load (and not reload when the button is clicked). In this, I am calling the FillCity() method to add city names and their Id's to the dictionary property of the modal. Finally, I returned this modal. This returns the model ( and its values ) to the index view.
- ClimateModel openWeatherMap = FillCity();
In return view statement, I passed this model class object.
- return View(openWeatherMap);
In an Index action result, method of HttpPost attribute I added my model class file.I created created one function called FillCity() and assign to ClimateModel class object.
- ClimateModel openWeatherMap = FillCity();
The Post ActionResult Index will be called whenever the page is postback (through the button click). Actually in my View, I will have cities that a user can select in radio input control and a button, which when clicked should do API call and fetch the selected city’s weather.This means on clicking the button, this Post ActionResult will be called.This ActionResult has 1 parameters string cities.
It means the cities Parameter will get me the city Id of the selected city from the view (on the button click, of course).Next, I am making the OpenWeatherMap API call, using C# classes HttpWebRequest & HttpWebResponse. You need to add the namespace, using System.Net; to your Controller on the top. I am also using StreamReader class (namespace System.IO) to read the response (JSON). I now have the JSON, so let us serialize it. The serialization is done by JsonConvert class. You can add the reference to this from NuGet Package Manager.
With this line of code (ResponseWeather rootObject = JsonConvert.DeserializeObject<responseweather>(apiResponse);) I will fetch the values from JSON and add them to my Helper class. All this in 1 line of code and that purely due to the magic of JsonConvert class.
I am creating an HTML table, which contains the city weather details, using StringBuilder (namespace System.Text). The StringBuilder value is added to model apiResponse property.
I passed one string parameter in an Index action result method of HttpPost attribute.
- [HttpPost]
- public ActionResult Index(string cities)
Put the condition of cities string parameter value, which is not null. It will append all the data related to climate information, which is based on the selection of the user.
I check, if the cities is not null, only then I will call API. This is done so that the user is bound to select at least one city radio input.
I used it for calling API.
http://openweathermap.org/api
I used my own generated API key, which is given below.
- string apiKey = "Put Your Own Api Key";
To generate your own API key, follow the mentioned steps given above.
To make request of API key, we should use the HttpWebRequest class and WebRequest class files.
HttpWebRequest = This class provides http specific implementation of WebRequest class.
WebRequest = This abstract class makes a request to uniform resource identifier.
Now, we use one URL to pass the CITYID and an APIKEY.
http://api.openweathermap.org/data/2.5/weather?id=" + cities + "&appid=" + apiKey + "&units=metric
For calling API, the codes are mentioned below.
- string apiKey = " Put Your Own Api Key ";
- HttpWebRequest apiRequest = WebRequest.Create("http://api.openweathermap.org/data/2.5/weather?id=" + cities + "&appid=" + apiKey + "&units=metric") as HttpWebRequest;
-
- string apiResponse = "";
- using (HttpWebResponse response = apiRequest.GetResponse() as HttpWebResponse)
- {
- StreamReader reader = new StreamReader(response.GetResponseStream());
- apiResponse = reader.ReadToEnd();
- }
Using an object of parent class “ResponseWeather” defined in Helper class, I will access some properties and respective roles.
Here, I used “JsonConvert” system defined class, which can be accessed through namespace
- “using Newtonsoft.Json;”
- ResponseWeather rootObject = JsonConvert.DeserializeObject<ResponseWeather>(apiResponse);
This is related to http://json2csharp.com online tool.
Now, I will create one string builder class called “StringBuilder”.
Using an object of parent class “ResponseWeather” defined in Helper class, we can access all the properties and the roles.
- StringBuilder sb = new StringBuilder();
- sb.Append("<table><tr><th>Weather Description</th></tr>");
- sb.Append("<tr><td>City:</td><td>" + rootObject.name + "</td></tr>");
- sb.Append("<tr><td>Country:</td><td>" + rootObject.sys.country + "</td></tr>");
- sb.Append("<tr><td>Country Sun Rise:</td><td>" + rootObject.sys.sunrise + "</td></tr>");
- sb.Append("<tr><td>Country Sun Sete:</td><td>" + rootObject.sys.sunset + "</td></tr>");
- sb.Append("<tr><td>Wind:</td><td>" + rootObject.wind.speed + " Km/h</td></tr>");
- sb.Append("<tr><td>Current Temperature:</td><td>" + rootObject.main.temp + " °C</td></tr>");
- sb.Append("<tr><td>Max. Temperature:</td><td>" + rootObject.main.temp_max + " °C</td></tr>");
- sb.Append("<tr><td>Min. Temperature:</td><td>" + rootObject.main.temp_min + " °C</td></tr>");
- sb.Append("<tr><td>Pressure:</td><td>" + rootObject.main.pressure + "</td></tr>");
- sb.Append("<tr><td>Humidity:</td><td>" + rootObject.main.humidity + "</td></tr>");
- sb.Append("<tr><td>Weather:</td><td>" + rootObject.weather[0].description + "</td></tr>");
- sb.Append("</table>");
- openWeatherMap.apiResponse = sb.ToString();
If the user is not selected, just click the button and it will show one message to the end user.
If the cities value is null and button submit is clicked (when a user does not selects any city and clicks submit button), I can put “Choose Your Correct City” text inside the apiResponse property of the model. Here, I used one tempdata variable = -1 . Based on this tempdata value, the popup will be shown to thr end user .
- else
- {
- if (Request.Form["submit"] != null)
- {
-
- TempData["SelectOption"] = -1;
- }
- }
In return view statement, I passed this model class object.
- return View(openWeatherMap);
I created one function, using model class file named “FillCity()”. Here, I added some City Name and City ID. Pass only these, using API, URL and get the details.
- public ClimateModel FillCity()
- {
- ClimateModel openWeatherMap = new ClimateModel();
- openWeatherMap.cities = new Dictionary<string, string>();
- openWeatherMap.cities.Add("Mumbai", "1275339");
- openWeatherMap.cities.Add("New Delhi", "1261481");
- openWeatherMap.cities.Add("Bangalore", "1277333");
- openWeatherMap.cities.Add("Bhubaneshwar", "1275817");
- openWeatherMap.cities.Add("Khurda", "1266616");
- openWeatherMap.cities.Add("Cuttack", "1273780");
- openWeatherMap.cities.Add("Hyderabad", "1269843");
- openWeatherMap.cities.Add("Philadelphia", "4560349");
- return openWeatherMap;
- }
Only these above mentioned cities will be shown in Output page and helps to fulfill your requirements.
If you want more, then you can add more city name along with the respective CityID, using URL.
http://openweathermap.org/help/city_list.txt
The work of this function is to add the city names and their Id's to the dictionary property of the Model.
Step 5
Now, I have added one view named Index.cshtml.
Code Ref
- @model ClimateReport.Models.ClimateModel
- <style>
- #SatyaDiv {
- padding-left: 20px;
- }
-
- #SatyaDiv select, #SatyaDiv button {
- background-color: #4CAF50;
- border: none;
- color: white;
- padding: 15px 32px;
- text-align: center;
- text-decoration: none;
- display: inline-block;
- font-size: 16px;
- margin: 4px 2px;
- cursor: pointer;
- border-radius: 50%;
- }
-
- #SatyaDiv #message table {
- width: 100%;
- border: solid 3px green;
- color: blue;
- font-style: oblique;
- font-family: Georgia;
- font-weight: bold;
- background: yellow;
- }
-
- #SatyaDiv #message table th {
- text-align: left;
- color: white;
- font-style: oblique;
- background: Blue;
- }
- </style>
- @{ ViewBag.Title = "CLIMATE API IN ASP.NET MVC";}
- <h2 style="background-color: Yellow;color: Blue; text-align: center; font-style: oblique">SATYA'S CLIMATE API TO GET CLIMATE REPORT OF PLACES</h2>
- <fieldset>
- <legend style="font-family:Arial Black;color:blue">CHECK LATEST CLIMATE REPORT</legend>
- <div id="SatyaDiv">
- <h4 style="color:crimson">Choose Place To Check Climate Report</h4>
- @using (Html.BeginForm())
- {
- foreach (var city in Model.cities)
- {
- <span>
- @Html.RadioButtonFor(m => m.cities, city.Value) @city.Key
- </span>
- }
-
- <button name="submit">Show Report</button>
- }
- <div id="message">@(new HtmlString(Model.apiResponse))</div>
- </div>
- </fieldset>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
- <script>
- $(document).ready(function () {
- $("input[id='cities']").change(function () {
- $(this).parents("#SatyaDiv").find("span").css("background", "none");
- $(this).parent().css("background", "");
- });
- });
- </script>
-
- @if (TempData["SelectOption"] != null)
- {
- <script type="text/javascript">
- alert("Select Any One Place To Get Today's Latest Climate Report");
- </script>
- }
-
- <footer>
- <p style="background-color: Yellow; font-weight: bold; color:blue; text-align: center; font-style: oblique">© @DateTime.Now.ToLocalTime()</p> @*Add Date Time*@
- </footer>
Code description
I have added one namespace called “@model ClimateReport.Models.ClimateModel”.
I have created on CSS style sheet and inside it, I used one DIV ID called “#SatyaDiv”.
- <style>
- #SatyaDiv {
- padding-left: 20px;
- }
-
- #SatyaDiv select, #SatyaDiv button {
- background-color: #4CAF50;
- border: none;
- color: white;
- padding: 15px 32px;
- text-align: center;
- text-decoration: none;
- display: inline-block;
- font-size: 16px;
- margin: 4px 2px;
- cursor: pointer;
- border-radius: 50%;
- }
-
- #SatyaDiv #message table {
- width: 100%;
- border: solid 3px green;
- color: blue;
- font-style: oblique;
- font-family: Georgia;
- font-weight: bold;
- background: yellow;
- }
-
- #SatyaDiv #message table th {
- text-align: left;
- color: white;
- font-style: oblique;
- background: Blue;
- }
- </style>
For button style purpose, I added the code, as shown below.
- #SatyaDiv select, #SatyaDiv button {
- background-color: #4CAF50;
- border: none;
- color: white;
- padding: 15px 32px;
- text-align: center;
- text-decoration: none;
- display: inline-block;
- font-size: 16px;
- margin: 4px 2px;
- cursor: pointer;
- border-radius: 50%;
- }
For table data and table header style, I added the code, as shown below.
- #SatyaDiv #message table {
- width: 100%;
- border: solid 3px green;
- color: blue;
- font-style: oblique;
- font-family: Georgia;
- font-weight: bold;
- background: yellow;
- }
-
- #SatyaDiv #message table th {
- text-align: left;
- color: white;
- font-style: oblique;
- background: Blue;
- }
Now, I put radio buttons control and submit button.
The radio button lists come from model class function, as defined in controller class file.
- foreach (var city in Model.cities)
- {
- <span>
- @Html.RadioButtonFor(m => m.cities, city.Value) @city.Key
- </span>
- }
-
- <button name="submit">Show Report</button>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
- <script>
- $(document).ready(function () {
- $("input[id='cities']").change(function () {
- $(this).parents("#SatyaDiv").find("span").css("background", "none");
- $(this).parent().css("background", "");
- });
- });
- </script>
Here, I used one jQuery script file to change the color of an input radio button and for this, I have to add jQuery script file reference path.
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
Here, I used one popup message, which is based on tempdata variable value, if the user did not select any radio button and just select Submit button.
- @if (TempData["SelectOption"] != null)
- {
- <script type="text/javascript">
- alert("Select Any One Place To Get Today's Latest Climate Report");
- </script>
- }
Also, you can use this message type instead of JavaScript alert.
- <div id="message">@(new HtmlString(Model.apiResponse))</div>
Here, in “Model.apiResponse” area, you should manually put the warning message and show to the end user.
- openWeatherMap.apiResponse = "Choose Your Correct City";
Here, I added current date time in the footer section.
- <footer>
- <p style="background-color: Yellow; font-weight: bold; color:blue; text-align: center; font-style: oblique">© @DateTime.Now.ToLocalTime()</p> @*Add Date Time*@
- </footer>
A view forms UI of MVC Application.
I added the reference to the Modal class “@model ClimateReport.Models.ClimateModel”. This is because the model class will transfer the values from the Controller to the view.
- @using (Html.BeginForm())
This code is for creating a form. MVC form is created with Html.BeginForm()). Note that in MVC when the form contains a button, only then the button will causes the Postback.
Now, I create "#SatyaDiv” div and inside it, I created another form, which contains the city radio input controls and a submit button.To create the city radio button, I am looping through the dictionary property of the modal (cities). Now, I am creating them, using an MVC premade function- Html.RadioButtonFor(m => m.cities, city.Value).@city. Key will show the city names on the view.
@(new HtmlString(Model.apiResponse)) will show an HTML table or text “Choose Your Correct City” inside the message div.
This means the message div will show the weather details of the selected city to the users.
I added few lines of jQuery code.
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
- <script>
- $(document).ready(function () {
- $("input[id='cities']").change(function () {
- $(this).parents("#SatyaDiv").find("span").css("background", "none");
- $(this).parent().css("background", "green");
- });
- });
- </script>
Now, proceed, as shown below.
Step 6
Configure URL setting of this MVC app.
Code Ref
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using System.Web.Routing;
-
- namespace ClimateReport
- {
- public class RouteConfig
- {
- public static void RegisterRoutes(RouteCollection routes)
- {
- routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
-
- routes.MapRoute(
- name: "Default",
- url: "{controller}/{action}/{id}",
- defaults: new { controller = "ClimateMap", action = "Index", id = UrlParameter.Optional }
- );
- }
- }
- }
Code description
Here, controller name is ClimateMap and controller action method name is an Index.
It is related with View or UI of this MVC app.
Step 7
You should have compulsory internet connection to access this feature of jQuery Script as well as this Climate API key.
Pic Refs
Without an internet connection, this jQuery scipt file can’t be downloaded and the feature is unable to be seen.
Output
The URL of this MVC app is given below.
http://localhost:54445/ClimateMap/Index
Here, controller name is ClimateMap and controller action method name is an Index.
Without the selection of any city radio button, if we click Show Report button you will get a warning message.
Select any city radio button and the climate details will come.
When you select Bangalore, it displays, as shown below.
When you select Philadelphia, it will be displayed, as shown below.
Here, you can see the City name, Country name, Temperature and Pressure, as defined in controller class file etc.
Here, you can check footer section of this climate MVC application .
Summary
- How to get climate API key
- How to get city name and city ID
- How the API key and city ID passed to the earlier mentioned URL in controller class file
- How to use inside MVC Application to get the latest climate information report