SlideShare a Scribd company logo
Binu Bhasuran
Microsoft MVP - Visual C#
What is Web API?
What is Web API?
The ASP.NET Web API is an extensible
framework for building HTTP based services
that can be accessed in different applications on
different platforms such as web, windows,
mobile etc.
Asp.net web api
ASP.NET Web API is an ideal platform for
building RESTful services.
ASP.NET Web API is built on top of ASP.NET and
supports ASP.NET request/response pipeline
ASP.NET Web API maps HTTP verbs to method
names
ASP.NET Web API supports different formats of
response data. Built-in support for JSON, XML,
BSON format.
ASP.NET Web API can be hosted in IIS, Self-
hosted or other web server that supports .NET
4.0+.
ASP.NET Web API framework includes new
HttpClient to communicate with Web API server.
HttpClient can be used in ASP.MVC server side,
Windows Form application, Console application
or other apps.
Asp.net web api
Asp.net web api
Choose WCF if you use .NET Framework 3.5. Web
API does not support .NET 3.5 or below.
Choose WCF if your service needs to support
multiple protocols such as HTTP, TCP, Named pipe.
Choose WCF if you want to build service with WS-*
standards like Reliable Messaging, Transactions,
Message Security.
Choose WCF if you want to use Request-Reply, One
Way, and Duplex message exchange patterns.
Choose Web API if you are using .NET
framework 4.0 or above.
Choose Web API if you want to build a service
that supports only HTTP protocol.
Choose Web API to build RESTful HTTP based
services.
Choose Web API if you are familiar with ASP.NET
MVC.
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Web API Controller is similar to ASP.NET MVC
controller. It handles incoming HTTP requests
and send response back to the caller.
Asp.net web api
Asp.net web api
It must be derived from System.Web.Http.ApiController
class.
It can be created under any folder in the project's root
folder. However, it is recommended to create controller
classes in the Controllers folder as per the convention.
Action method name can be the same as HTTP verb
name or it can start with HTTP verb with any suffix (case
in-sensitive) or you can apply Http verb attributes to
method.
Return type of an action method can be any primitive or
complex type. Learn more about it here.
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Web API supports code based configuration. It
cannot be configured in web.config file. We
can configure Web API to customize the
behaviour of Web API hosting infrastructure
and components such as routes, formatters,
filters, DependencyResolver, MessageHandlers,
ParamterBindingRules, properties, services etc.
Asp.net web api
Asp.net web api
Web API configuration process starts when the application
starts. It calls
GlobalConfiguration.Configure(WebApiConfig.Register) in
the Application_Start method. The Configure() method
requires the callback method where Web API has been
configured in code. By default this is the static
WebApiConfig.Register() method.
As you can see above, WebApiConfig.Register() method
includes a parameter of HttpConfiguration type which is
then used to configure the Web API. The HttpConfiguration
is the main class which includes following properties using
which you can override the default behaviour of Web API.
Asp.net web api
Web API supports two types of routing:
Convention-based Routing
Attribute Routing
Convention-based Routing
In the convention-based routing, Web API uses
route templates to determine which controller
and action method to execute. At least one
route template must be added into route table
in order to handle various HTTP requests.
Asp.net web api
Asp.net web api
Attribute Routing
Attribute routing is supported in Web API 2. As
the name implies, attribute routing uses [Route()]
attribute to define routes. The Route attribute
can be applied on any controller or action
method.
Attribute Routing
Action methods in Web API controller can have
one or more parameters of different types. It can
be either primitive type or complex type. Web
API binds action method parameters either with
URL's query string or with request body
depending on the parameter type
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
[FromUri] and [FromBody]
Use [FromUri] attribute to force Web API to get
the value of complex type from the query
string and [FromBody] attribute to get the
value of primitive type from the request body,
opposite to the default rules.
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Void
Primitive type or Complex type
HttpResponseMessage
IHttpActionResult
.
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Web API controller always returns an object of
HttpResponseMessage to the hosting
infrastructure. The following figure illustrates
the overall Web API request/response pipeline.
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
The IHttpActionResult was introduced in Web
API 2 (.NET 4.5). An action method in Web API
2 can return an implementation of
IHttpActionResult class which is more or less
similar to ActionResult class in ASP.NET MVC.
Asp.net web api
Create Custom Result Type
You can create your own custom class as a result
type that implements IHttpActionResult
interface.
Asp.net web api
Media Type
Content-Type
Media Type
Media type (aka MIME type) specifies the
format of the data as type/subtype e.g.
text/html, text/xml, application/json,
image/jpeg etc.
Content-Type
In HTTP request, MIME type is specified in the
request header using Accept and Content-
Type attribute. The Accept header attribute
specifies the format of response data which the
client expects and the Content-Type header
attribute specifies the format of the data in the
request body so that receiver can parse it into
appropriate format.
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Web API handles JSON and XML formats based
on Accept and Content-Type headers. But, how
does it handle these different formats?
The answer is: By using Media-Type formatters.
Media type formatters are classes responsible
for serializing request/response data so that
Web API can understand the request data
format and send data in the format which client
expects.
Asp.net web api
BSON Formatter
Web API also supports BSON format. As the
name suggests, BSON is binary JSON, it is a
binary-encoded serialization of JSON-like
documents. Currently there is very little support
for BSON and no JavaScript implementation is
available for clients running in browsers. This
means that it is not possible to retrieve and
automatically parse BSON data to JavaScript
objects.
BSON Formatter
Web API includes built-in formatter class
BsonMediaTypeFormatter for BSON but it
is disabled by default.
JSON Formatter
The JsonMediaTypeFormatter converts JSON
data in an HTTP request into CLR objects (object
in C# or VB.NET) and also converts CLR objects
into JSON format that is embeded within HTTP
response.
Configure JSON Serialization
XML Formatter
The XmlMediaTypeFormatter class is
responsible for serializing model objects into
XML data. It uses
System.Runtime.DataContractSerializer class to
generate XML data.
Web API includes filters to add extra logic
before or after action method executes. Filters
can be used to provide cross-cutting features
such as logging, exception handling,
performance measurement, authentication and
authorization.
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api
Asp.net web api

More Related Content

PPT
3 Tier Architecture
PDF
Html / CSS Presentation
PPT
Asp.net.
PDF
C# ASP.NET WEB API APPLICATION DEVELOPMENT
PPT
Introduction to Cascading Style Sheets (CSS)
PPT
Javascript Basics
3 Tier Architecture
Html / CSS Presentation
Asp.net.
C# ASP.NET WEB API APPLICATION DEVELOPMENT
Introduction to Cascading Style Sheets (CSS)
Javascript Basics

What's hot (20)

ODP
Authentication & Authorization in ASPdotNet MVC
PPT
Java Servlets
PPT
cascading style sheet ppt
PPTX
Front-End Web Development
PDF
JavaScript - Chapter 12 - Document Object Model
PPSX
ASP.NET Web form
PPTX
PPTX
.Net Core
PPTX
ReactJS presentation.pptx
PPT
Master pages
PPTX
Spring Boot Tutorial
PPTX
jstl ( jsp standard tag library )
PPTX
Simple object access protocol(soap )
PPTX
Web forms in ASP.net
PPT
Java collections concept
PPTX
Lecture 2_ Intro to laravel.pptx
PPTX
PPT
Javascript
PPTX
PDF
Spring annotation
Authentication & Authorization in ASPdotNet MVC
Java Servlets
cascading style sheet ppt
Front-End Web Development
JavaScript - Chapter 12 - Document Object Model
ASP.NET Web form
.Net Core
ReactJS presentation.pptx
Master pages
Spring Boot Tutorial
jstl ( jsp standard tag library )
Simple object access protocol(soap )
Web forms in ASP.net
Java collections concept
Lecture 2_ Intro to laravel.pptx
Javascript
Spring annotation
Ad

Similar to Asp.net web api (20)

PDF
ASP.NET Web API Interview Questions By Scholarhat
PPTX
C# web api
PPTX
ASP.NET Mvc 4 web api
PPTX
Mastering-ASPNET-Web-API-and-RESTful-Patterns.pptx
PDF
Difference between asp.net web api and asp.net mvc
PPTX
Implementation web api
PPTX
Web api
PPTX
Building-Robust-APIs-ASPNET-Web-API-and-RESTful-Patterns.pptx
PDF
Unleash the power of HTTP with ASP.NET Web API
PDF
Complete guidance book of Asp.Net Web API
PPTX
Web API or WCF - An Architectural Comparison
PPTX
06 web api
PPTX
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
PPTX
Will be an introduction to
PPTX
Web API with ASP.NET MVC by Software development company in india
PPTX
Website RESTful APIs
PPTX
Improving Perceived Page Performance with ASP.NET Web API and AJAX
PPTX
PPT
Excellent rest using asp.net web api
PPTX
Rest WebAPI with OData
ASP.NET Web API Interview Questions By Scholarhat
C# web api
ASP.NET Mvc 4 web api
Mastering-ASPNET-Web-API-and-RESTful-Patterns.pptx
Difference between asp.net web api and asp.net mvc
Implementation web api
Web api
Building-Robust-APIs-ASPNET-Web-API-and-RESTful-Patterns.pptx
Unleash the power of HTTP with ASP.NET Web API
Complete guidance book of Asp.Net Web API
Web API or WCF - An Architectural Comparison
06 web api
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
Will be an introduction to
Web API with ASP.NET MVC by Software development company in india
Website RESTful APIs
Improving Perceived Page Performance with ASP.NET Web API and AJAX
Excellent rest using asp.net web api
Rest WebAPI with OData
Ad

More from Binu Bhasuran (13)

PPTX
Design patterns fast track
PDF
Microsoft Azure solutions - Whitepaper
PPTX
C# Basics
PPTX
Microsoft Managed Extensibility Framework
PPTX
Restful Services With WFC
PPTX
Design patterns
PDF
Wcf development
PPTX
.Net platform an understanding
PDF
Biz talk
PDF
Moving from webservices to wcf services
PDF
Model view view model
PDF
Beginning with wcf service
PDF
Asynchronous programming in .net 4.5 with c#
Design patterns fast track
Microsoft Azure solutions - Whitepaper
C# Basics
Microsoft Managed Extensibility Framework
Restful Services With WFC
Design patterns
Wcf development
.Net platform an understanding
Biz talk
Moving from webservices to wcf services
Model view view model
Beginning with wcf service
Asynchronous programming in .net 4.5 with c#

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
cuic standard and advanced reporting.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Modernizing your data center with Dell and AMD
PDF
Chapter 3 Spatial Domain Image Processing.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Cloud computing and distributed systems.
PDF
KodekX | Application Modernization Development
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Encapsulation theory and applications.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
cuic standard and advanced reporting.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Modernizing your data center with Dell and AMD
Chapter 3 Spatial Domain Image Processing.pdf
The AUB Centre for AI in Media Proposal.docx
20250228 LYD VKU AI Blended-Learning.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Review of recent advances in non-invasive hemoglobin estimation
Cloud computing and distributed systems.
KodekX | Application Modernization Development
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx

Asp.net web api

  • 2. What is Web API?
  • 3. What is Web API?
  • 4. The ASP.NET Web API is an extensible framework for building HTTP based services that can be accessed in different applications on different platforms such as web, windows, mobile etc.
  • 6. ASP.NET Web API is an ideal platform for building RESTful services. ASP.NET Web API is built on top of ASP.NET and supports ASP.NET request/response pipeline ASP.NET Web API maps HTTP verbs to method names ASP.NET Web API supports different formats of response data. Built-in support for JSON, XML, BSON format.
  • 7. ASP.NET Web API can be hosted in IIS, Self- hosted or other web server that supports .NET 4.0+. ASP.NET Web API framework includes new HttpClient to communicate with Web API server. HttpClient can be used in ASP.MVC server side, Windows Form application, Console application or other apps.
  • 10. Choose WCF if you use .NET Framework 3.5. Web API does not support .NET 3.5 or below. Choose WCF if your service needs to support multiple protocols such as HTTP, TCP, Named pipe. Choose WCF if you want to build service with WS-* standards like Reliable Messaging, Transactions, Message Security. Choose WCF if you want to use Request-Reply, One Way, and Duplex message exchange patterns.
  • 11. Choose Web API if you are using .NET framework 4.0 or above. Choose Web API if you want to build a service that supports only HTTP protocol. Choose Web API to build RESTful HTTP based services. Choose Web API if you are familiar with ASP.NET MVC.
  • 16. Web API Controller is similar to ASP.NET MVC controller. It handles incoming HTTP requests and send response back to the caller.
  • 19. It must be derived from System.Web.Http.ApiController class. It can be created under any folder in the project's root folder. However, it is recommended to create controller classes in the Controllers folder as per the convention. Action method name can be the same as HTTP verb name or it can start with HTTP verb with any suffix (case in-sensitive) or you can apply Http verb attributes to method. Return type of an action method can be any primitive or complex type. Learn more about it here.
  • 24. Web API supports code based configuration. It cannot be configured in web.config file. We can configure Web API to customize the behaviour of Web API hosting infrastructure and components such as routes, formatters, filters, DependencyResolver, MessageHandlers, ParamterBindingRules, properties, services etc.
  • 27. Web API configuration process starts when the application starts. It calls GlobalConfiguration.Configure(WebApiConfig.Register) in the Application_Start method. The Configure() method requires the callback method where Web API has been configured in code. By default this is the static WebApiConfig.Register() method. As you can see above, WebApiConfig.Register() method includes a parameter of HttpConfiguration type which is then used to configure the Web API. The HttpConfiguration is the main class which includes following properties using which you can override the default behaviour of Web API.
  • 29. Web API supports two types of routing: Convention-based Routing Attribute Routing
  • 30. Convention-based Routing In the convention-based routing, Web API uses route templates to determine which controller and action method to execute. At least one route template must be added into route table in order to handle various HTTP requests.
  • 33. Attribute Routing Attribute routing is supported in Web API 2. As the name implies, attribute routing uses [Route()] attribute to define routes. The Route attribute can be applied on any controller or action method.
  • 35. Action methods in Web API controller can have one or more parameters of different types. It can be either primitive type or complex type. Web API binds action method parameters either with URL's query string or with request body depending on the parameter type
  • 43. [FromUri] and [FromBody] Use [FromUri] attribute to force Web API to get the value of complex type from the query string and [FromBody] attribute to get the value of primitive type from the request body, opposite to the default rules.
  • 50. Void Primitive type or Complex type HttpResponseMessage IHttpActionResult .
  • 55. Web API controller always returns an object of HttpResponseMessage to the hosting infrastructure. The following figure illustrates the overall Web API request/response pipeline.
  • 60. The IHttpActionResult was introduced in Web API 2 (.NET 4.5). An action method in Web API 2 can return an implementation of IHttpActionResult class which is more or less similar to ActionResult class in ASP.NET MVC.
  • 62. Create Custom Result Type You can create your own custom class as a result type that implements IHttpActionResult interface.
  • 65. Media Type Media type (aka MIME type) specifies the format of the data as type/subtype e.g. text/html, text/xml, application/json, image/jpeg etc.
  • 66. Content-Type In HTTP request, MIME type is specified in the request header using Accept and Content- Type attribute. The Accept header attribute specifies the format of response data which the client expects and the Content-Type header attribute specifies the format of the data in the request body so that receiver can parse it into appropriate format.
  • 74. Web API handles JSON and XML formats based on Accept and Content-Type headers. But, how does it handle these different formats? The answer is: By using Media-Type formatters.
  • 75. Media type formatters are classes responsible for serializing request/response data so that Web API can understand the request data format and send data in the format which client expects.
  • 77. BSON Formatter Web API also supports BSON format. As the name suggests, BSON is binary JSON, it is a binary-encoded serialization of JSON-like documents. Currently there is very little support for BSON and no JavaScript implementation is available for clients running in browsers. This means that it is not possible to retrieve and automatically parse BSON data to JavaScript objects.
  • 78. BSON Formatter Web API includes built-in formatter class BsonMediaTypeFormatter for BSON but it is disabled by default.
  • 79. JSON Formatter The JsonMediaTypeFormatter converts JSON data in an HTTP request into CLR objects (object in C# or VB.NET) and also converts CLR objects into JSON format that is embeded within HTTP response.
  • 81. XML Formatter The XmlMediaTypeFormatter class is responsible for serializing model objects into XML data. It uses System.Runtime.DataContractSerializer class to generate XML data.
  • 82. Web API includes filters to add extra logic before or after action method executes. Filters can be used to provide cross-cutting features such as logging, exception handling, performance measurement, authentication and authorization.

Editor's Notes

  • #3: ASP.NET Web API is a framework for building HTTP services that can be accessed from any client including browsers and mobile devices. It is an ideal platform for building RESTful applications on the .NET Framework. Before we understand what is Web API, let's see what is an API (Application Programing Interface).
  • #4: As per Wikipedia's Definition of API: In computer programming, an application programming interface (API) is a set of subroutine definitions, protocols, and tools for building software and applications. To put it in simple terms, API is some kind of interface which has a set of functions that allow programmers to access specific features or data of an application, operating system or other services.
  • #5: It works more or less the same way as ASP.NET MVC web application except that it sends data as a response instead of html view. It is like a webservice or WCF service but the exception is that it only supports HTTP protocol.
  • #6: It works more or less the same way as ASP.NET MVC web application except that it sends data as a response instead of html view. It is like a webservice or WCF service but the exception is that it only supports HTTP protocol.
  • #13: In a typical console application in C#, execution starts from the Main() function. The Main() function controls the flow of a program or in other words sequence of user interaction. Consider the following simple console program In the above example, the Main() function of the program class controls the flow of a program. It takes user's input for the first Name and last name. It saves the data, continues or exits the console depending upon the user's input. So here, flow of the control through the Main() function.
  • #15: Fiddler Postman
  • #17: Web API controller is a class which can be created under the Controllers folder or any other folder under your project's root folder. The name of a controller class must end with "Controller" and it must be derived from System.Web.Http.ApiController class. All the public methods of the controller are called action methods.
  • #19: If you want to write methods that do not start with an HTTP verb then you can apply the appropriate http verb attribute on the method such as HttpGet, HttpPost, HttpPut etc. same as MVC controller.
  • #33: In the above example, School route is configured before DefaultApi route. So any incoming request will be matched with the School route first and if incoming request url does not match with it then only it will be matched with DefaultApi route. For example, request url is http://localhost:1234/api/myschool is matched with School route template, so it will be handled by SchoolController.
  • #35: In the above example, the Route attribute defines new route "api/student/names" which will be handled by the Get() action method of StudentController. Thus, an HTTP GET request http://localhost:1234/api/student/names will return list of student names.
  • #36: By default, if parameter type is of .NET primitive type such as int, bool, double, string, GUID, DateTime, decimal or any other type that can be converted from string type then it sets the value of a parameter from the query string. And if the parameter type is complex type then Web API tries to get the value from request body by default.
  • #38: As you can see above Get action method includes id parameter of int type. So, Web API will try to extract the value of id from the query string of requested URL, convert it into int and assign it to id parameter of Get action method. For example, if an HTTP request is http://localhost/api/student?id=1 then value of id parameter will be 1. Followings are valid HTTP GET Requests for the above action method. http://localhost/api/student?id=1 http://localhost/api/student?ID=1
  • #40: As you can see above, Post() action method includes primitive type parameters id and name. So, by default, Web API will get values from the query string. For example, if an HTTP POST request is http://localhost/api/student?id=1&name=steve then the value of id will be 1 and name will be "steve" in the above Post() method.
  • #41: Web API will extract the JSON object from the Request body above and convert it into Student object automatically because names of JSON object properties matches with the name of Student class properties (case-insensitive).
  • #42: The above Post method includes both primitive and complex type parameter. So, by default , Web API will get the id parameter from query string and student parameter from the request body.
  • #43: The above Post method includes both primitive and complex type parameter. So, by default , Web API will get the id parameter from query string and student parameter from the request body. Parameter binding for Put and Patch method will be the same as Post method in Web API.
  • #44: By default, if parameter type is of .NET primitive type such as int, bool, double, string, GUID, DateTime, decimal or any other type that can be converted from string type then it sets the value of a parameter from the query string. And if the parameter type is complex type then Web API tries to get the value from request body by default.
  • #45: In the above example, Get method includes complex type parameter with [FromUri] attribute. So, Web API will try to get the value of Student type parameter from the query string. For example, if an HTTP GET request http://localhost:xxxx/api/student?id=1&name=steve then Web API will create Student object and set its id and name property values to the value of id and name query string
  • #46: As you can see above, we have applied [FromUri] attribute with the Student parameter. Web API by default extracts the value of complex type from request body but here we have applied [FromUri] attribute. So now, Web API will extract the value of Student properties from the query string instead of request body.
  • #53: Primitive or Complex Type An action method can return primitive or other custom complex types as other normal methods.
  • #54: As you can see above, GetId action method returns an integer and GetStudent action method returns a Student type. An HTTP GET request http://localhost:xxxx/api/student?name=john will return following response in Fiddler. Primitive Return Type in Response
  • #55: An HTTP GET request http://localhost:xxxx/api/student?id=1 will return following response in Fiddler.
  • #57: As you can see in the above figure, the Web API controller returns HttpResponseMessage object. You can also create and return an object of HttpResponseMessage directly from an action method. The advantage of sending HttpResponseMessage from an action method is that you can configure a response your way. You can set the status code, content or error message (if any) as per your requirement.
  • #61: You can create your own class that implements IHttpActionResult or use various methods of ApiController class that returns an object that implement the IHttpActionResult.
  • #69: Web API converts request data into CLR object and also serialize CLR object into response data based on Accept and Content-Type headers. Web API includes built-in support for JSON, XML, BSON, and form-urlencoded data. It means it automatically converts request/response data into these formats OOB (out-of the box).
  • #70: As you can see above, the Post() action method accepts Student type parameter, saves that student into DB and returns inserted student with generated id. The above Web API handles HTTP POST request with JSON or XML data and parses it to a Student object based on Content-Type header value and the same way it converts insertedStudent object into JSON or XML based on Accept header value.
  • #80: Internally, JsonMediaTypeFormatter uses third-party open source library called Json.NETto perform serialization.
  • #81: JSON formatter can be configured in WebApiConfig class. The JsonMediaTypeFormatter class includes various properties and methods using which you can customize JSON serialization. For example, Web API writes JSON property names with PascalCase by default. To write JSON property names with camelCase, set the CamelCasePropertyNamesContractResolver on the serializer settings as shown below.
  • #83: Filters are actually attributes that can be applied on the Web API controller or one or more action methods. Every filter attribute class must implement IFilter interface included in System.Web.Http.Filters namespace. However, System.Web.Http.Filters includes other interfaces and classes that can be used to create filter for specific purpose.