ASP.NET Core Web API Tutorials
In this ASP.NET Core Web API Tutorial, we are going to cover all the concepts of ASP.NET Core Web API with real-time examples. You will learn from the very basic to the advanced level features of ASP.NET Core Web API as you progress in this ASP.NET Core Web API Tutorial Course.
This ASP.NET Core Web API Tutorial is For whom:
This tutorial is designed for Students, Beginners, Intermediate, and Professionals Developers who want to learn ASP.NET Core Web API step by step from very basics to advanced level concepts. This ASP.NET Core Web API Tutorial provides a hands-on approach to the subject with step-by-step program examples that will assist you to learn and put the acquired knowledge into practice.
Why do we need Web APIs?
Suppose you have an idea to develop a product and launch it into the market. For this what you need is, you need to develop a website and launch this product. Then what you will do? You will develop a website using any technologies like ASP.NET MVC, PHP, ASP.NET Core, JSP, etc. that are available in the market and of course, you will need a database such as MySQL, Oracle, SQL Server, etc. to store the entire business data of your product.
So, by combining the website and the database, you will have a fully functionally dynamic website that interacts with the database. Now after some time, your business grows. Now along with the website, you also want Android App and iOS App. That means you want three different applications (Website, Android, and iOS) for your business. But remember you only have one database in the backend which stores the entire business data. So, we have three different applications and one database. So, all these three applications have to interact with the database as shown in the below image.
If all the above three applications are interacting with the database directly, then we have some problems. Let us understand the problems first and then we will see how to overcome the above problems.
Problems without Web APIs:
- Duplicate logic for each Application: The business should have some business logic. And for each type of application, we will write the same logic that means repeating the same logic for each type of application. This will duplicate our code.
- Error-Prone Code: The business logic has written in each type of application. In our example, we have to write the code in three different applications. So, there are chances you might miss some code or logic in some applications. This will add more errors to your application.
- Some Front-end frameworks cannot communicate directly with the Database: If you are developing the website (i.e. front-end) using the angular framework, then the angular framework cannot communicate with the database directly. Angular is a front-end framework.
- Hard to Maintain: This type of structure is hard to maintain. This is because we have written the code in many places and if we want to improve something in our application, then we need to do the same thing in many places.
There are also lots of other problems that we face in this structure. Let us see how to overcome the above problems or we can say why do we need Web APIs.
Need for Web APIs:
As you can see in the below image, on the left-hand side, we have all the three applications and on the right-hand side, we have the database as shown in the below image.
Our goal is to establish communication between all these three applications and the database. So, what we will do? We will add a new Web API Project. This Web API Project will interact with the database. And all three applications will only interact with the Web API Project as shown in the below image.
So, these websites, Android, and iOS applications do not have direct access to the database. They only need to communicate with the Web API project and it is the Web API project’s responsibility to interact with the database. And the entire business logic will be written in the Web API project only and this is the reason why we need Web API for our project. So, Web API acts as a mediator between the front-end and backend.
Advantages of Web API:
- Using Web API, we can avoid code duplication: We can write the logic in one place i.e. in our Web API project and that logic is going to be used by all applications.
- Extend Application Functionality: Suppose, first we develop one website. Then we can extend and develop Android App. Again, in the future, if you want to add another type of application, then for this we don’t have to write any kind of logic.
- Abstraction: As we have written all the business logic in our Web API project, we have added an extra layer of abstraction. The logic that we have written in the Web API project will not be visible to the front-end developers.
- Security: None of the applications can access the database directly and hence it provides security.
What is Web API?
API stands for Application Programming Interface. Web API is a concept (not a technology) that works on the HTTP Protocol and it is used to extend the functionality of an application.
How to Create Web API?
If the Web API is not a technology, then can we create Web API? We can develop Web APIs using different technologies such as Java, .NET, Node, etc. Each technology provides a couple of frameworks to develop Web APIs.
Creating Web API using .NET:
In .NET we have the following two frameworks to develop Web APIs.
- ASP.NET Web API2 (using .NET Framework)
- ASP.NET Core (using .NET Core)
.NET Core is the latest, open-source and fastest framework to develop Web APIs. In this course, we are going to learn how to use ASP.NET Core Framework to develop Web APIs.
What you will learn from this ASP.NET Core Tutorials Course?
At the end of this course, you will be able to
- Develop Restful Web API with ASP.NET Core and Entity Framework core
- Consume Web APIs in Angular Application
- Lots of Key Concept of ASP.NET Core Framework
Features that we are going to discuss in this course:
As part of this course, we are going to discuss the following concepts
1. Fundamental of Web APIs
2. Restful APIs
4. Dependency Injection
6. Format Response
7. Model Binder
9. Entity Framework Core 5.0
10. Consume APIs in Angular Application
11. Login and Signup with JWT
Prerequisites for this ASP.NET Core Web API Course:
You should have the following knowledge before starting this course.
- Basic knowledge of C# (Interfaces, Classes, Methods, Data Types, Collections, etc.)
- Basic Knowledge of Databases (Table, Columns, etc.)
Note: If we missed any concepts or topics in this ASP.NET Core Web API Course, then please let us know by putting a comment in the comment box and we promise you, as soon as possible we will put an article on that topic.
Last but not the least, your feedback is important and means a lot to us. So, if you have a few minutes, please let us know your thoughts and feedback on this course.