Web API Interview Questions to brush up on
1 message
Scaler Academy <academy@updates.scaler.com> Mon, 1 Nov, 2021 at 11:09 AM
Reply to: academy@scaler.com
To: - <smilekhare80@gmail.com>
1. Why is the Web API important?
Web API is generally considered as a service that basically
provides us information or data from the server. It is very
important because of the following reasons:
It is used to provide an interface for websites and client
applications to have access to data.
It can also be used to access data from the database
and save data back to the database.
It supports different text formats such as XML, JSON,
etc.
It uses low bandwidth such as XML or JSON data, etc.,
and is therefore considered good for devices that have
limited bandwidth such as smartphones, etc.
2. What are Web API filters?
Authentication Filter: It handles authentication and
authenticates HTTP requests. It also helps to
authenticate user detail. It checks the identity of the user.
Authorization Filter: It handles authorization. It runs
before controller action. This filter is used to check
whether or not a user is authenticated. If the user is not
authenticated, then it returns an HTTP status code 401
without invoking the action.
AuthorizeAttribute is a built-in authorization filter
provided by Web API.
Action Filter: It is attributing that one can apply to
controller action or entire controller. It is used to add
extra logic before or after controller action executes. It is
simply a way to add extra functionality to Web API
services.
Exception Filter: It is used to handle exceptions that are
unhandled in Web API. It is used whenever controller
actions throw an unhandled exception that is not
HttpResponseException. It will implement an
“IExceptionFilter” interface.
Override Filter: It is used to exclude specific action
methods or controllers from the global filter or controller
level filter. It is simply used to modify the behavior of
other filters for individual action methods.
To read the remaing 36 questions on Web API Interview
Questionss click on the button below:
Read On
3. What are the advantages of using Rest in Web API?
REST is very important and beneficial in Web API because of
the following reasons:
It allows less data transfer between client and server.
It is easy to use and lightweight.
It provides more flexibility.
It also handles and controls various types of calls,
returning various data formats.
It is considered best for using it in mobile apps because
it makes less data transfer between client and server.
It uses simple HTTP calls for inter-machine
communication rather than using more complex options
like CORBA, COM , SOAP, or RPC.
4. Who can consume Web API?
Web API generally provides greater flexibility in terms of
handling errors. Exception handling is a technique that is
used to handle run-time errors in application code. One can
use HttpResponseException, HttpError, Exception filters,
register exception filters, Exception handlers to handle errors.
Exception filter can be used to identify unhandled exceptions
on actions or controllers, exception handlers can be used to
identify any type of unhandled exception application-wide,
and HttpResponseException can be used when there is the
possibility of an exception.
To read the remaing 36 questions on Web API Interview
Questionss click on the button below:
Read On
Copyright © 2021 Scaler.com, All rights reserved
You are getting this mail because your e-mail ID is registered with us. To stop receiving these mails click- Unsubscribe