YouTube Icon

Interview Questions.

Top 100+ Web Api Interview Questions And Answers - May 24, 2020

fluid

Top 100+ Web Api Interview Questions And Answers

Question 1. What Is Web Api?

Answer :

Unlike WCF provider Web API is a framework that is used to build/develop Http primarily based services.

Question 2. What Is Rest?

Answer :

    REST stands for Representational state switch.
    It is a architectural fashion, which defines policies for creating scalable offerings.
    REST is works on HTTP protocol using its verbs GET, POST, PUT and DELETE.

ASP.NET Interview Questions

Question 3. Can We Do Unit Test Web Api?

Answer :

Web API can be unit take a look at through the usage of Fiddler tool.

Following is the settings to be up to date in Fiddler:

Compose Tab -> Enter Request Headers -> Enter the Request Body and execute.

Question four. Can Web Api Return View In Mvc?

Answer :

We cannot return view from Web API.

ASP.NET Tutorial

Question 5. How To Restrict Access To Methods With Specific Http Verbs In Web Api?

Answer :

With the assist of Attributes(like http verbs) it is easy to enforce get entry to regulations in Web API.

We can outline HTTP verbs as characteristic over technique to restriction access.

Example :

 [HttpPost]

 public void SampleMethod(SampleClass obj)

 

    //logic

 

Framework7 Interview Questions

Question 6. What Is Web Api Routing?

Answer :

Routing is nothing but sample matching like in MVC.

All routes will get registered in Route Tables.

Example :

Routes.MapHttpRoute(

 Name: "SampleWebAPIRoute",

 routeTemplate: “api/controller/identification

 defaults: new  id = RouteParameter.Optional

;

Question 7. Differences Between Wcf And Web Api?

Answer :

WCF :

    WCF is a framework used for construct/increase service oriented programs.
    WCF may be consumed through customers which could recognize XML.
    WCF helps huge range of protocols like HTTP, TCP, Named Pipes and more.
    For each method there must be attributes like – “WebGet” and “WebInvoke”
    For REST carrier we need to apply attribute “WebInvoke”.

Web API:

    Web API is a framework used to build/increase HTTP based services.
    Web API is an open supply platform.
    It supports best HTTP protocol.
    Web API may be hosted in IIS or in application.
    Unlike WCF Rest we can use complete features of HTTP in Web API
    This returns XML or JSON to consumer.

Framework7 Tutorial HTTP Interview Questions

Question eight. What Are The Advantages Of Using Rest In Web Api?

Answer :

    REST used to make less information transfers among client and server.
    Web API supports HTTP protocol verbs for conversation.

Question nine. With Wcf Also You Can Implement Rest, So Why Webapi?

Answer :

    WCF changed into delivered in to put in force SOA, never the intention was to put in force REST.
    Web API is built from Scratch and the simplest aim is to create HTTP offerings the usage of REST.

Windows Communication Foundation (WCF) Interview Questions

Question 10. Web Api Where Is The Proxy?

Answer :

Web API would not make it clean for consumers to generate a provider consumer like a SOAP WSDL does. If you are handiest ever going to have .NET customers it is no longer a huge deal because they are able to proportion the contract objects you put in force, but different language clients will want to manually create their customer objects in case you don't use SOAP.

HTTP Tutorial

Question eleven. What Are The Advantages Using Webapi?

Answer :

    OData assist (via Queryable characteristic)
    Content Negotiation
    Filters
    Model binding and validation
    Ability to self host outdoor of IIS
    Link era to associated assets that includes routing policies
    Full help for routes/routing
    Ability to create custom assist and take a look at pages the use of ApiExplorer

Java XML Interview Questions

Question 12. Differentiate Between Wcf And Web Api?

Answer :

WCF - Windows Communication Foundation(WCF) has been created by Microsoft with .NET Framework 3.Zero. It supports SOAP primarily based services. It has compatibility with HTTP, TCP, UDP, and many others. Good for developing secure and interoperable offerings. Used for again give up purposes.

WEB API - Web API open supply framework. It has compatibility with HTTP best. It has a assist for non-SOAP based totally offerings. It may be very light weight subsequently good for developing services for low bandwidth gadgets. It supports OData. It supports most of the MVC features. Used for front stop purposes.

ASP.NET Interview Questions

Question 13. What Is Testapi?

Answer :

TestApi is a library of utility and take a look at APIs thru which testers and builders create testing tools and automatic checks for .NET and Win32 software using facts-structure and algorithms.

Windows Communication Foundation (WCF) Tutorial

Question 14. What Are Exception Filters?

Answer :

Exception filters may be finished when some of the exceptions are unhandled and thrown from a controller approach. The reason for the exception may be something. Exception filters will put into effect "Exception Filter" interface.

Question 15. How Can We Register Exception Filters?

Answer :

Three alternatives are available to register Exception Filters which are From Action, From Controller and Global registration.

JSON (JavaScript Object Notation) Interview Questions

Question 16. How Can We Register Exception Filter From Action?

Answer :

We can check in exception clear out from action the use of following code

[NotImp ExceptionFilter]

public Test Customer Get My Test Customer(in custid)

 

//write the code

 

Java XML Tutorial

Question 17. How Can We Register Exception Filter From Controller?

Answer :

We can check in exception filter out from controller the usage of following code:

[NotImp ExceptionFilter]

public elegance Test CustomerController : Controller

 

// write the code

 

Oracle iPlanet Web Server (OiWS) Interview Questions

Question 18. How Can We Register Exception Filter Globally?

Answer :

We can register exception filter globally using following code:

GlobalConfiguration.Configuration.Filters.Add(new MyTestCustomerStore.NotImplExceptionFilterAttribute());

Framework7 Interview Questions

Question 19. How To Handle Errors In Web Api?

Answer :

Several lessons are to be had in Web API to handle mistakes. They are HttpError, HttpResponseException, Exception Filters, Registering Exception Filters.




CFG