The Highest Post
WebApi Top questions

Find by name:


New Post

Recent Post

  • Peter Agyekum What is Web API?

    Web API is a framework which is used to build/develop HTTP services.

    Peter Agyekum Why is Web API required? Is it possible to use RESTful services using WCF?

    Yes, we can still develop RESTful services with WCF. However, there are two main reasons that prompt users to use Web API instead of RESTful services. Web API increases TDD (Test Data Driven) approach in the development of RESTful services. If we want to develop RESTful services in WCF, you surely need a lot of config settings, URI templates, contracts & endpoints for developing RESTful services using web API.

    Peter Agyekum Why select Web API?

    It is used to create simple, non-SOAP-based HTTP Services It is also an easy method for creation with Web API. With WCF REST Services It is based on HTTP and easy to define, expose and consume in a REST-ful way. It is lightweight architecture and ideal for devices that have limited bandwidth like smartphones.

    Peter Agyekum What are the advantages of Web API?

    OData Filters Content Negotiation Self-Hosting Routing Model Bindings

    Peter Agyekum What are main return types supported in Web API?

    Void – It will return an empty content HttpResponseMessage - It will convert the response to an HTTP message. IHttpActionResult - internally calls ExecuteAsync to create an HttpResponseMessage Other types - You can write the serialized return value into the response body

    Peter Agyekum Web API supports which protocol?

    Web App supports HTTP protocol.

    Peter Agyekum Which .NET framework supports Web API?

    NET 4.0 and above version supports web API.

    Peter Agyekum By default, Web API sends HTTP response with which of the following status code for all uncaught exception?

    500 - Internal Server Error

    Peter Agyekum What is Web API Routing?

    All routes are registered in Route Tables. For example: Routes.MapHttpRoute( Name: "ExampleWebAPIRoute", routeTemplate: “api/{controller}/{id} defaults: new { id = RouteParameter.Optional}

    Peter Agyekum What is SOAP?

    SOAP is an XML message format used in web service interactions. It allows to send messages over HTTP or JMS, but other transport protocols can be used. It is also an XML-based messaging protocol for exchanging information among computers.

    Peter Agyekum How to you can limit Access to Web API to Specific HTTP Verb?

    Attribute programming plays a important role. It is easy to restrict access to an ASP.NET Web API method to be called using a particular HTTP method.

    Peter Agyekum What is the meaning of TestApi?

    TestApi is a utility library of APIs. Using this library tester developer can create testing tools and automated tests for a .NET application using data-structure and algorithms.

    Peter Agyekum How you can return View from ASP.NET Web API method?

    No, we can't return a view from ASP.NET Web API Method. Web API creates HTTP services that render raw data. However, it's also possible in ASP.NET MVC application.

    Peter Agyekum How to register exception filter globally?

    It is possible to register exception filter globally using following code- GlobalConfiguration.Configuration.Filters.Add(new MyTestCustomerStore.NotImplExceptionFilterAttribute());

    Peter Agyekum Explain what is REST and RESTFUL?

    REST represents REpresentational State Transfer; it is entirely a new aspect of writing a web app. RESTFUL: It is term written by applying REST architectural concepts is called RESTful services. It focuses on system resources and how the state of the resource should be transported over HTTP protocol.

    Peter Agyekum Give me one example of Web API Routing?

    Config.Routes.MapHttpRoute( name: "MyRoute,"//route name routeTemplate: "api/{controller}/{action}/{id}",//as you can see "API" is at the beginning. defaults: new { id = RouteParameter.Optional } );

    Peter Agyekum How can you handle errors in Web API?

    Several classes are available in Web API to handle errors. They are HttpError, Exception Filters, HttpResponseException, and Registering Exception Filters.

    Peter Agyekum What New Features comes with ASP.NET Web API 2.0?

    Attribute Routing, Cross-Origin Resource Sharing, External Authentication, Open Web Interface NET, HttpActionResult, Web API OData,

    Peter Agyekum Name the tools or API for developing or testing web api?

    Jersey API CFX Axis Restlet

    Peter Agyekum What is REST?

    REST is architectural style. It has defined guidelines for creating services which are scalable. REST used with HTTP protocol using its verbs GET, PUT, POST and DELETE.

    Peter Agyekum How to unit test Web API?

    We can perform a Unit test using Web API tools like Fiddler. Here, are some setting to be done if you are using Fiddler –Compose Tab -> Enter Request Headers -> Enter the Request Body and execute

    Peter Agyekum Tell me the code snippet to show how we can return 404 errors from HttpError?

    string message = string.Format(“TestCustomer id = {0} not found”, customerid); return Request.CreateErrorResponse(HttpStatusCode.NotFound, message);

    Peter Agyekum Web API supports which protocol?

    Web App support HTTP protocol

    Peter Agyekum By default, Web API sends HTTP response with which of the following status code for all uncaught exception?

    500 - Internal Server Error

    Peter Agyekum Explain method to handle error using HttpError in Web API?

    In WEB API HttpError used to throw the error info in the response body. “CreateErrorResponse” method is can also use along with this, which is an extension method defined in “HttpRequestMessageExtension.”

    Peter Agyekum How to handle errors in Web API?

    Several classes are available in Web API to handle errors. They are HttpError, HttpResponseException, Exception Filters, Registering Exception Filters.

    Peter Agyekum State differences between MVC and WebAPI

    MVC framework is used for developing applications which have User Interface. For that, views can be used for building a user interface. WebAPI is used for developing HTTP servi

    Peter Agyekum Who can consume WebAPI?

    WebAPI can be consumed by any client which supports HTTP verbs such as GET, PUT, DELETE, POST. As WebAPI services don’t need any configuration, they are very easy to consume by any client. Infract, even portable devices like Mobile devices can easily consume WebAPI which is certainly the biggest advantages of this technology.

    Peter Agyekum Compare Web API and WCF?

    WCF offers request-reply, one-way, or duplex while Web API is by default request-reply only. WCF is used for developing SOAP-based services whereas Web API is used for both SOAP-based and RESTful services. WCF does not offer any support for MVC features whereas Web API supports MVC features. WCF supports HTTP, UDP, and custom transport protocol whereas Web API supports only HTTP protocol. WCF offers Text, MTOM, and Binary Encoding support whereas Web API supports the UTF-8 encoding format. WCF supports message queues, message security, duplex communication, transaction whereas Web API doesn’t support. WCF stands for Windows Communication Foundation whereas API stands for Application Program Interface.

    Peter Agyekum What is Page event?

    The page event is fired when table's paging state changes. This can be the end user selecting the page to view or the page length from the built-in controls, or when the page state is altered by the API ( page() ). Note that the page will be fired before the table has been redrawn with the updated data.

    Peter Agyekum What is an API and how is it used?

    API is the acronym for Application Programming Interface, which uses HTTP protocol and that allows two applications to talk to each other, send an instant message.

    Peter Agyekum What is endpoint in REST API?

    Simply put, an endpoint is one end of a communication channel. When an API interacts with another system, the touchpoints of this communication are considered endpoints. For APIs, an endpoint can include a URL of a server or service. ... The place that APIs send requests and where the resource lives, is called an endpoint.

    Peter Agyekum What is a REST based API?

    A RESTful API is an architectural style for an application program interface (API) that uses HTTP requests to access and use data. The API spells out the proper way for a developer to write a program requesting services from an operating system or other application.

    Peter Agyekum What is the content negotiation in Web API?

    Content negotiation is the process of selecting the best representation for a given response when there are multiple representations available. Means, depending on the Accept header value in the request, the server sends the response. The primary mechanism for content negotiation in HTTP are these request headers − Accept − Which media types are acceptable for the response, such as "application/json," "application/xml," or a custom media type such as "application/vnd.example+xml" Accept-Charset − Which character sets are acceptable, such as UTF-8 or ISO 8859-1. Accept-Encoding − Which content encodings are acceptable, such as gzip. Accept-Language − The preferred natural language, such as "en-us". The server can also look at other portions of the HTTP request. For example, if the request contains an X-Requested-With header, indicating an AJAX request, the server might default to JSON if there is no Accept header.

    Peter Agyekum What is Cross-Origin Resource Sharing (CORS)?

    Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources. CORS also relies on a mechanism by which browsers make a "preflight" request to the server hosting the cross-origin resource, in order to check that the server will permit the actual request. In that preflight, the browser sends headers that indicate the HTTP method and headers that will be used in the actual request. For security reasons, browsers restrict cross-origin HTTP requests initiated from scripts. For example, XMLHttpRequest and the Fetch API follow the same-origin policy. This means that a web application using those APIs can only request resources from the same origin the application was loaded from unless the response from other origins includes the right CORS headers.

    Kussi Test Web api55

    yes