Tuesday 23 February 2021

WebAPI Interview Questions

 1) What is Webapi? Ans: It is framework used to build /develop HTTP services

2) Why to use WebAPI? Ans: It is simple & non-SOAP based HTTP services. It is lightweight architecture & ideal for devices that have limited bandwidth like smartphones

3)Advantages of WebAPI? Ans: 

*Odata Protocol 
*Filters
* Content Negotiation
*Self Hosting
* Model Bindings
*Routing

4) How to handle errors in WebAPI? Ans: There are certain classes in WebAPI to handle errors
*HttpError *Exception Filters *HttpResponceException *Registering Exception Filters 

5) New Features of Asp.Net WebApi 2.0? Ans: * Attribute Routing *Cross-Origin Resource Sharing
*External Authentication*HttpActionResult * Open Data Protocol

6) Use Of DelegatingHandler? Ans: Used to represent message handlers before routing

7) Content Negotiation in WebAPI? Ans: It is process of selecting the best representation for given response when there are multiple representations are available. There are two main headers which are responsible for Content Negotiation i.e
* Content Type: It tells the server about the data which is received from the client
* Accept: It tells the format of data requested by client from the server

8) Media-Type formatter?  Ans: It is abstract class from which   JsonMediaTypeFormatter
 (handle json format) & XmlMediaTypeFormatter (handle xml format) are derived from.
 Media-Type formatter class responsible for serializing the data in the format that client asked for.



No comments:

Post a Comment