In this tutorial, we are going to discuss about Web API , why Web Api
required etc. This article can be used to understand API
concept by any beginner, intermediate and
professional. Here we willl cover the following:
- What is Web API
- Types of Web API
- .NET Core API Introduction
- ASP.NET Core Web API Testing Tools
- Why ASP.NET Core Web API required
- Advantages of ASP.NET Core Web API
- Disadvantage of ASP.NET Core Web API
1. What is Web API?
is the acronym for Application Programming Interface. Web Api is an intermediate
Programming Interface that allows two or more applications to intract or
communicate with each other. It uses HTTP protocol to communicate between
clients (Browser) and websites. The following are the most widely used
examples of web API.
- Google Maps API
- Twitter API
2. Types of Web API
Basically when you develop API with its purpose. there are four
types of web API as following:
- Open API - Public APIs are implied to be open for all,
that means there is no restrictions on access and are publicly available for
- Partner API - Access to this category of APIs is
extended through a licensure model.
- Internal API - This type of API used
for in house or internal purpose. The organization tests the veracity
of its services/products usually with such APIs.
- Composite APIs - They are a sequence of processes
triggered when a series of other tasks are executed.
3. .NET Core Web API Introduction
.NET Core is a free, open-source, cross-platform framework developed by Microsoft for building modern applications. It is a modular and lightweight platform that allows developers to build applications that run on Windows, macOS, and Linux.
Here are some key Characteristics or
- Cross-platform - .NET Core is designed to be cross-platform, meaning you can develop and run applications on multiple operating systems, including Windows, macOS, and Linux. This allows for greater flexibility and reach for your applications.
- Open-source - .NET Core is an open-source framework and is developed in collaboration with the .NET community. This means that developers have access to the source code, can contribute to the framework, and benefit from community-driven enhancements and bug fixes.
- Modular and Lightweight - .NET Core follows a modular design, with its functionality split into smaller packages called NuGet packages. This modular approach allows developers to include only the necessary components in their applications, resulting in smaller and more efficient deployments.
- High Performance - .NET Core is optimized for performance and is known for its fast startup times and efficient resource utilization. It includes features such as Just-in-Time (JIT) compilation, which dynamically compiles code for execution, and Ahead-of-Time (AOT) compilation, which pre-compiles code for even faster startup.
- Multiple Application Types -
.NET Core supports a variety of application types, including console applications, web applications (ASP.NET Core), microservices, cloud-based applications, and IoT (Internet of Things) applications. This flexibility allows developers to choose the most suitable application model for their specific needs.
- Language Support - .NET Core supports multiple programming languages, including C#, F#, and Visual Basic. This allows developers to choose their preferred language for application development while leveraging the power and capabilities of the .NET platform.
- Integration with Visual Studio - .NET Core integrates seamlessly with Microsoft's popular integrated development environment (IDE), Visual Studio. Developers can leverage Visual Studio's rich set of tools and features for code editing, debugging, testing, and deployment of .NET Core applications.
- Cloud and Container Support - .NET Core is designed with cloud and container environments in mind. It supports popular cloud platforms such as Microsoft Azure and Amazon Web Services (AWS). It also has built-in support for containerization technologies like Docker, allowing for easy deployment and scalability of applications.
- Long-Term Support (LTS) Versions - Starting with .NET Core 3.1, Microsoft introduced Long-Term Support (LTS) versions of .NET Core. These LTS versions receive three years of support and are recommended for applications that require stability and long-term maintenance.
- Migration Path from .NET Framework -
For developers with existing .NET Framework applications, Microsoft provides tools and guidance for migrating to .NET Core. This allows you to modernize your applications and take advantage of the benefits and features offered by .NET Core.
4. ASP.NET Core Web API Testing Tools?
The following are the testing tools for Web API.
- Katalon Studio
- Soap UI
- Karate DSL
5. Why is ASP.NET Core Web API required?
Web API have the feature of cross-platform framework. The user wants to access the application from
different devices like mobile, browser, Google devices etc. In this type
API can be useful source. Different devices send request to Web API and Web API will
in JSON format. Most of the devices are able to understand JSON format Output.
see the below web Api Architecture which shows how different devices can access
In the above diagram a client (Browers, Phones, Talets and Devices) called
API controller. API Controller communcate with business layer and get Data from DB.
The output will be returned in JSON format.
6. ASP.NET Core Web APIAdvantages
There are following Advantages of Web API when we use.
- It supports non-soap based services like xml or json string.
- It supports full features of HTTP (like Get, Put, Post, Delete for CRUD
- It widely supported clients like browsers and
- It can be hosted in IIS or outside of IIS(self hosted).
- It Supports all the MVC Feature like routing, controllers
- It supports OData
- It supports model binding and validations.
- Unlike WCF REST services, there is no need to define tedious
configuration settings for different devices in Web API.
- API helps you to expose service data to the browser.
7. ASP.NET Core Web API Disadvantages
There are following Disadvantages of Web API when we use.
- Creating API is a very time-consuming process.
- A fixed scale is necessary.
- To create API, programming knowledge is necessary.
- Maintenance cost is very high.
- It can crash when testing API.