In this C# Web API tutorial, beginners will learn first what a web API in C# is and then what an ASP.NET web API is. Learn about the features of the asp.net web API in this C# tutorial. and we will become acquainted with all of the versions of the asp.net web API. This Simplileran tutorial explains the distinction between ASP.NET and WCF (Windows Communication Foundation). Following that, we will learn when to use ASP.NET and when to use WCF. Finally, for a better learning experience, we will see a practical demonstration of C# Web API in this C# programming tutorial.
10. What is Web API?
An application programming interface (API) is a set of subroutine definitions, protocols, and tools
for developing software and applications in computer programming.
11. What is Web API?
API is a type of interface with a set of functions that allow programmers to access specific
features or data of an application, operating system, or other services.
12. What is Web API?
As the name implies, Web API is a web-based API that can be accessed via the HTTP protocol.
It is a concept rather than a technology. We can create Web APIs using various technologies
such as Java, NET, and others. Twitter's REST APIs, for example, provide programmatic access
to read and write data, allowing us to integrate Twitter's capabilities into our application.
13.
14. ASP .NET Web API
Web API
HTTP Response Data
(JSON/XML/Other
Format)
HTTP Request
HTTP Response Data
(JSON/XML/Other
Format)
HTTP Request
HTTP
Request
HTTP
Response
Data
(JSON/XML/Other
Format)
The ASP.NET Web API is an extensible framework for creating HTTP-based services that can be
accessed in various applications on various platforms such as web, windows, mobile etc.
Web
Application
Mobile
Application
Win Form
Application
15. ASP .NET Web API
It functions similarly to an ASP.NET MVC web application, except it sends data as a response
instead of an HTML view. It functions similarly to a web service or WCF service, except it only
supports the HTTP protocol.
Web API
HTTP Response Data
(JSON/XML/Other
Format)
HTTP Request
HTTP Response Data
(JSON/XML/Other
Format)
HTTP Request
HTTP
Request
HTTP
Response
Data
(JSON/XML/Other
Format)
Web
Application
Mobile
Application
Win Form
Application
16.
17. The ASP.NET Web API platform is ideal for developing RESTful
services.
ASP .NET Web API Characteristics
18. ASP.NET Web API is based on ASP.NET and supports the
ASP.NET request/response pipeline. HTTP verbs are
translated into method names by ASP.NET Web API.
ASP .NET Web API Characteristics
19. The ASP.NET Web API supports a variety of response data
formats. JSON, XML, and BSON format support is built-in.
ASP .NET Web API Characteristics
20. ASP.NET Web API can be hosted in IIS, Self-hosted, or any
other web server that supports.NET 4.0 or higher.
ASP .NET Web API Characteristics
21. To communicate with the Web API server, the ASP.NET Web
API framework includes a new HTTP Client. HTTP Client can
be used on the server-side of ASP, MVC, in Windows Form
applications, Console applications, and other apps.
ASP .NET Web API Characteristics
22.
23. ASP .NET Web API Versions
Web API Version Supported .NET
Framework
Coincides with Supported in
Web API 1.0 .NET Framework 4.0 ASP.NET MVC 4 VS 2010
Web API 2 - Current .NET Framework 4.5 ASP.NET MVC 5 VS 2012, 2013
24.
25. ASP .NET Web API vs WCF
Web API WCF
It is open source and comes with the.NET
framework.
The.NET framework is included.
Only the HTTP protocol is supported. HTTP, TCP, UDP, and custom transport protocols
are all supported.
Http verbs to methods mapping The attributes-based programming model is
used.
Like ASP.NET MVC, it employs a routing and
controller concept.
Contracts for Service, Operation, and Data are
used.
It does not support Reliable Messaging or
transactions.
Reliable Messaging and Transactions are
supported.
The HTTP Configuration class can configure web
APIs, but not web. Config.
To configure a service, use the web. Config and
attributes.
It's ideal for creating RESTful services. RESTful services are supported but with
limitations.
26. ASP .NET Web API vs WCF
If you're using.NET Framework 3.5, go with WCF. Web API
does not work with.NET 3.5 or lower.
27. ASP .NET Web API vs WCF
If your service must support multiple protocols, such as
HTTP, TCP, and Named Pipes, use WCF.
28. ASP .NET Web API vs WCF
Choose WCF if you want to create services that adhere to
WS-* standards such as Reliable Messaging, Transactions,
and Message Security.
29. ASP .NET Web API vs WCF
If you want to use the Request-Reply, One-Way, and Duplex
message exchange patterns, go with WCF.
30.
31. When to Choose ASP .NET Web API
If you are using.NET framework 4.0 or higher, select Web
API.
32. If you want to build a service that only supports the HTTP
protocol, goes with Web API.
When to Choose ASP .NET Web API
33. To create RESTful HTTP-based services, use Web API.
When to Choose ASP .NET Web API
34. If you're familiar with ASP.NET MVC, go with Web API.
When to Choose ASP .NET Web API