Tuesday 23 March 2021

Part 4 : Creating WeatherForcast API

# 3 minutes of reading

I’m using visual studio 2019 version 16.9.2 for creating Web API project. By default Core provide API template which create default WeatherForecast controller and render json data on browser. Lets understand with below example.
Select API template from below screen, make sure highlighted filters applied like language is c#, Windows OS and Web application.
Provide meaningfull name to your project.
For API series I’m using .Net Core 3.1 SDK shown below
Project gets created with API template. Below is highlighted controller class. All Http methods (GET, PUT, POST, and DELETE) methods written in API and data/information required to rendered on browser can retrive from other classes or projects like (entity framework, business layers, Inmemory data). I will show in coming articles.
As discussed Weatherforcast controller gets created default with template and once execute API application Json data gets rendered on browser.
Above highlighted controller name is required as it is attribute routing, I will explain later about attribute routing.
For API testing Postman is used heavily, download postman software from here. Postman is heavily used for API testing. I will show you how can we test our API using Postman.
But in real time API gets called with the help of jQuery Ajax call by enabling CORS or HTTP Client. I will show you as we progress through the course.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home