ASP.NET Web API is a framework provided by the Microsoft with which we can easily build HTTP services that can reach a broad of clients, including browsers, mobile, IoT devices, etc. ASP.NET Web API provides an ideal platform for building REST ful applications on the .NET Framework.
So lets start with Best Web api interview question ….
1-What are Mashups in the field of Web API?
Answer- Mashups are one type of web application that merges the usage of numerous server-side web APIs. It utilizes materials from more than one resource to obtain a separate, solo service which is projected in a single graphical interface. The term basically relates to fast integration, commonly and regularly employing open application programming interfaces i.e. APIs to render enhanced results which were not necessarily the initial reason for generating the raw source data. The prominent features of a Mashup incorporate combination, visualization and aggregation.
2- What are Webhooks in the field of Web API?
Answer — Webhooks, also referred to as web callback or HTTP push API is the route for an application to supply other apps with real-time information. One gets the informationright away as it occurs, without any wastage of time. In other APIs, one is required to poll for data rather regularly and frequently so as to obtain it in real-time. Webhooks thus prove to be more friendly and efficient for both the service providers as well as the customers. The webhook works by making an HTTP request to the application and then it will get interpreted. The only disadvantage of a Webhook is that it is very tricky and complicated to set it up.
3-What is SOAP?
Answer- The full form of Soap is Simple Object Access Protocol and it is an XML-based messaging procedure for switching data amongst different computers. It provides the service of information exchange for Web services. SOAP is not dependent on any platform or any computer language; it is independent of any of them. It allows client applications to link up remote services and summon improbable methods and techniques.
4-What is meant by API TESTING?
Answer-API Testing is one kind of software checking which includes investigating application programming interfaces (APIs) precisely and directly, as a part of integration checking to check if they meet the required minimum expectations for safety, security, dependability, functionality, and performance. API Testing usually consists of having requests made to a solo or sometimes more than one endpoints and checking the response- either for performance or for safety or for just a regular security concern.API Testing puts more stress on the checking of trade logic, information responses and safety, and performance bottlenecks.
5 -How to tackle errors and bugs in Web API?
Answer- Errors and bugs can be quite easily fixed in WEB API. Various classes are accessible in Web API to check and tackle errors and bugs.Some of these are HttpError, Exception Filters, httpResponseException, and Registering Exception Filters among many others.
Answer-WebAPI can be utilized by any user or client which allows HTTP verbs like GET, POST, DELETE and PUT. These WebAPI services do not require any configuration, and so, they can be easily utilized and consumed by any client or user. In fact, all portable devices like smartphones, tablets can, without any major difficulty, consume WebAPI which is definitely one of the most prominent advantages and benefits of availing this technology.
7- What do you understand by Attribute Routing in ASP.NET Web API 2.0?
Answer-ASP.NET Web API v2 allows Attribute Routing apart from the tradition-bound approach. In tradition-based approaches, the route templates are pre-defined. Any incoming demand gets matched against pre-described route templates which further gets routed to controller action which has been matched. It gets completely difficult to support certain URI through conventional routing. Using attribute routing, one can very conveniently define hierarchies of resources.
8- Name kinds of Action Results in Web API 2.
Answer- A Web API controller action can result in the following responses-
-HttpResponseMessage- Returns empty 204(when there’s no content)
-Void- Returns empty 204(devoid of content)
-IHttpActionResult- Calls ExecuteAsync to make an HttpResponseMessage, then it gets -transformed to an HTTP response message.
-Other kind-Write the serialized return number into the response body, return 200(OK)
9- Define Delegate Handler.
Answer — Delegate Handler is one kind of message handler in Web API. It is mainly utilized to keep a check and track of the incoming request in Web API projects It is used for displaying or representing Message Handlers before the Routing process ensues.
10- How can one register Exception Filter universally?
Answer- One can register an exception filter universally by employing the following given code-
GlobalConfiguration.Configuration.Filters.Add (new MyTestCustomerStore.NotImplExceptionFilterAttribute());
Originally published at http://ruftuf.wordpress.com on December 6, 2019.