WebAPI & REST Flashcards
What is WebAPI ?
Web API controller delivers data and services easily by using HTTP REST services.
What is the advantage of WebAPI ?
HTTP is a most used protocol so by exposing your service over HTTP any nature of clients
can consume it , making it a true client server model. So your client can now be a mobile app
or app made in JS frameworks like react/Angular or must be a simple browser , every one
can integrate with WebAPI seamlessly.
Explain REST and Architectural constraints of REST?
Can we use UDP/TCPIP protocol with Web API?
NO
How WebAPI different from MVC controller ?
In MVC Controller we can return RAZOR views but in WebAPI we can not return Views.
WebAPI follows REST principles and does things like content negotiations.
What is content negotiations in Web API ?
Content negotiations looks at client accept type and depending on the client accept type it
provides data format. So if in the accept client sends XML it will send XML , if it sends
JSON it will send JSON.
WebAPI vs WCF ?
WCF was meant for SOA , XML is compulsory format and support any protocol.
WebAPI was meant for REST, No compulsion on Format and supports only HTTP protocol.
WCF REST vs WebAPI REST ?
WCF REST was creates to ensure that old legacy WCF can be REST enabled , While
WebAPI was built from scratch to serve REST architecture.For new project use WebAPI. If
you want to make legacy WCF compatible with REST you will used WCF REST.
How to return HTTP status codes ?
return StatusCode(StatusCodes.Status200OK,”Test”);
For error which status code is returned ?
500 internal server error.
How did you secure your web API ?
By using JWT token.
How do current JS frameworks work with webAPI ?
Client side is built usin JS frameworks like Angular , React and they communicate to MVC
using HTTP.
Further questions for self learning.
- What is the difference between creating .net std library and .net core library?
- what is use of UseRouting and UseEndpoints in Startup Configure method
- How to store ServiceCollection in different location other than ConfigureServices method
- What is ViewComponent? and can we inject Dependency in ViewComponent?
- how to use in-memory cache in asp.net core
- how to store object in session other than string and int in asp.net core.
- how to create CUSTOM MIDDLEWARE in ASP.NET CORE
- use of launchsetting.json in ASP.NET Core
- how to configure runtime compilation of views while development. :- AddRazorRuntimeCompilation();
- Health checks
ASYNCACTIONFILTER IN ASP.NET CORE MVC
How to Secure asp.net core with oAuth2.0 and what is oAuth middle ware
2. Authentication in asp.net core web api and OWIN
3. Explain factory pattern using built - in DI in asp.net core
.csproj file, and it’s importance in .net core. comparison of .csproj file with previous version of .net
Ways of implementing versioning in Asp.net core Api
What is IOption in ASP.NET core