YouTube Icon

Interview Questions.

Top 100+ Restful Web Service Interview Questions And Answers - Jun 01, 2020

fluid

Top 100+ Restful Web Service Interview Questions And Answers

Question 1. What Rest Stands For?

Answer :

REST stands for REpresentational State Transfer.

Question 2. What Is Rest?

Answer :

REST is internet standards based structure and makes use of HTTP Protocol for information communication. It revolves round resource where each component is a aid and a useful resource is accessed with the aid of a not unusual interface the use of HTTP general techniques. REST changed into first added by Roy Fielding in 2000.

In REST structure, a REST Server in reality offers get right of entry to to assets and REST client accesses and presents the assets. Here every useful resource is diagnosed by using URIs/ international IDs. REST uses various representations to symbolize a useful resource like textual content, JSON and XML. Now a days JSON is the most popular format being used in web offerings.

Web Service Testing Interview Questions
Question 3. Name Some Of The Commonly Used Http Methods Used In Rest Based Architecture?

Answer :

Following widely recognized HTTP methods are normally used in REST primarily based architecture:−

GET − Provides a examine most effective get admission to to a resource.
PUT − Used to create a new resource.
DELETE − Ued to eliminate a useful resource.
POST − Used to update a present resource or create a new resource.
OPTIONS − Used to get the supported operations on a aid.
Question 4. What Are Web Services?

Answer :

A internet carrier is a set of open protocols and standards used for exchanging information between programs or systems. Software applications written in various programming languages and running on various systems can use internet services to alternate records over laptop networks like the Internet in a manner just like inter-manner verbal exchange on a single laptop.

Web Service Testing Tutorial
Question 5. What Are Restful Web Services?

Answer :

Web services based on REST Architecture are called RESTful internet services. These net offerings use HTTP methods to implement the concept of REST architecture. A RESTful net provider usually defines a URI, Uniform Resource Identifier a service, offers useful resource illustration which include JSON and set of HTTP Methods.

Web Services Interview Questions
Question 6. What Is A Resource In Rest?

Answer :

REST structure treats each content as a useful resource. These sources may be text documents, html pages, photos, motion pictures or dynamic enterprise data. REST Server genuinely presents get right of entry to to resources and REST patron accesses and modifies the assets. Here every useful resource is diagnosed via URIs/ international IDs.

Question 7. How To Represent A Resource In Rest?

Answer :

REST makes use of numerous representations to represent a resource wherein textual content, JSON, XML. XML and JSON are the most popular representations of resources.

Web Services Tutorial Core Java Interview Questions
Question eight. What Are The Best Practices To Design A Resource Representation?

Answer :

Following are critical points to be taken into consideration at the same time as designing a illustration format of a aid in a RESTful web offerings:

Understandability − Both Server and Client have to be capable of understand and utilize the illustration layout of the aid.
Completeness − Format need to be able to represent a aid absolutely. For instance, a aid can comprise every other resource. Format should be able to represent simple in addition to complicated structures of assets.
Linkablity − A useful resource will have a linkage to every other resource, a layout need to be able to handles such situations.
Question 9. Which Protocol Is Used By Restful Web Services?

Answer :

RESTful web offerings make use of HTTP protocol as a medium of communication among purchaser and server.

Java-Springs Interview Questions
Question 10. What Is Messaging In Restful Web Services?

Answer :

A client sends a message in shape of a HTTP Request and server responds in shape of a HTTP Response. This technique is termed as Messaging. These messages comprise message records and metadata i.E. Facts about message itself.

Core Java Tutorial
Question 11. What Are The Core Components Of A Http Request?

Answer :

A HTTP Request has five main elements :

Verb − Indicate HTTP strategies consisting of GET, POST, DELETE, PUT etc.
URI − Uniform Resource Identifier (URI) to pick out the useful resource on server.
HTTP Version − Indicate HTTP version, for instance HTTP v1.1 .
Request Header − Contains metadata for the HTTP Request message as key-value pairs. For instance, customer ( or browser) type, layout supported through customer, format of message frame, cache settings and so forth.
Request Body − Message content material or Resource illustration.
CSS Interview Questions
Question 12. What Are The Core Components Of A Http Response?

Answer :

A HTTP Response has four most important parts:-

Status/Response Code − Indicate Server status for the asked resource. For instance 404 means resource now not determined and two hundred way reaction is good enough.
HTTP Version − Indicate HTTP version, as an instance HTTP v1.1 .
Response Header − Contains metadata for the HTTP Response message as key-fee pairs. For instance, content material duration, content kind, reaction date, server type and so on.
Response Body − Response message content or Resource illustration.
Web Service Testing Interview Questions
Question thirteen. What Is Addressing In Restful Web Services?

Answer :

Addressing refers to finding a resource or more than one assets lying at the server. It is similar to find a postal deal with of someone.

Java-Springs Tutorial
Question 14. What Is Uri?

Answer :

URI stands for Uniform Resource Identifier. Each aid in REST structure is recognized by using its URI.

Question 15. What Is Purpose Of A Uri In Rest Based Web Services?

Answer :

Purpose of an URI is to find a useful resource(s) at the server hosting the web provider.

Java Abstraction Interview Questions
Question sixteen. What Is Format Of A Uri In Rest Architecture?

Answer :

A URI is of following format:−

<protocol>://<service-name>/<ResourceType>/<ResourceID>

CSS Tutorial
Question 17. What Is The Purpose Of Http Verb In Rest Based Web Services?

Answer :

VERB identifies the operation to be achieved on the useful resource.

Amazon Web Services (AWS) Interview Questions
Question 18. What Are The Best Practices To Create A Standard Uri For A Web Service?

Answer :

Following are crucial points to be taken into consideration even as designing a URI −

Use Plural Noun − Use plural noun to outline assets. For instance, we have used users to identify users as a useful resource.
Avoid using spaces − Use underscore(_) or hyphen(-) whilst the usage of a long useful resource call, as an instance, use authorized_users in place of authorizedp.C20users.
Use lowercase letters − Although URI is case-insensitive, it is ideal exercise to preserve url in lower case letters most effective.
Maintain Backward Compatibility − As Web Service is a public carrier, a URI as soon as made public must always be to be had. In case, URI gets up to date, redirect the older URI to new URI the use of HTTP Status code, three hundred.
Use HTTP Verb − Always use HTTP Verb like GET, PUT, and DELETE to do the operations on the resource. It is not exact to apply operations names in URI.
Web Services Interview Questions
Question 19. What Is Statelessness In Restful Web Services?

Answer :

As per REST structure, a RESTful web provider have to now not preserve a customer state on server. This restriction is referred to as statelessness. It is responsibility of the client to skip its context to server and then server can save this context to system purchaser's similarly request. For instance, session maintained via server is diagnosed with the aid of consultation identifier surpassed by using the client.

Restful internet service Tutorial
Question 20. What Are The Advantages Of Statelessness In Restful Web Services?

Answer :

Following are the blessings of statelessness in RESTful web services:

Web offerings can treat every method request independently.
Web services need not to hold patron's previous interactions. It simplifies software design.
As HTTP is itself a statelessness protocol, RESTful Web services work seamlessly with HTTP protocol.
RESTful JAVA Web Services Interview Questions
Question 21. What Are The Disadvantages Of Statelessness In Restful Web Services?

Answer :

Following is the disadvantage of statelessness in RESTful net services:-

Web services want to get more information in each request and then interpret to get the client's state in case patron interactions are to be taken care of.

Question 22. What Do You Mean By Idempotent Operation?

Answer :

Idempotent operations approach their result will continually equal no matter how many times those operations are invoked.

Spring MVC Framework Tutorial
Question 23. Which Type Of Web Services Methods Are To Be Idempotent?

Answer :

PUT and DELETE operations are idempotent.

Spring MVC Framework Interview Questions
Question 24. Which Type Of Web Services Methods Are To Be Read Only?

Answer :

GET operations are study most effective and are secure.

Core Java Interview Questions
Question 25. What Is The Difference Between Put And Post Operations?

Answer :

PUT and POST operation are almost equal with the difference lying only in the result where PUT operation is idempotent and POST operation can motive distinctive end result.

Question 26. What Should Be The Purpose Of Options Method Of Restful Web Services?

Answer :

It should listing down the supported operations in an internet carrier and need to be examine best.

Soap Web Services Interview Questions
Question 27. What Should Be The Purpose Of Head Method Of Restful Web Services?

Answer :

It must go back simplest HTTP Header, no Body and should be study handiest.

Java-Springs Interview Questions
Question 28. What Is Caching?

Answer :

Caching refers to storing server response in client itself in order that a consumer desires not to make server request for identical useful resource over and over. A server reaction should have information approximately how a caching is to be done so that a customer caches response for a time frame or by no means caches the server response.

Question 29. Which Header Of Http Response, Provides The Date And Time Of The Resource When It Was Created?

Answer :

Date header provides the date and time of the aid when it changed into created.

Question 30. Which Header Of Http Response, Provides The Date And Time Of The Resource When It Was Last Modified?

Answer :

Last Modified header gives the date and time of the useful resource while it turned into remaining changed.

Question 31. Which Header Of Http Response Provides Control Over Caching?

Answer :

Cache-Control is the number one header to manipulate caching.

Question 32. Which Header Of Http Response Sets Expiration Date And Time Of Caching?

Answer :

Expires header sets expiration date and time of caching.

Question 33. Which Directive Of Cache Control Header Of Http Response Indicates That Resource Is Cacheable By Any Component?

Answer :

Public directive indicates that resource is cacheable via any aspect.

CSS Interview Questions
Question 34. Which Directive Of Cache Control Header Of Http Response Indicates That Resource Is Catchable By Only Client And Server, No Intermediary Can Cache The Resource?

Answer :

Private directive suggests that resource is cachable via only customer and server, no middleman can cache the useful resource.

Question 35. Which Directive Of Cache Control Header Of Http Response Indicates That Resource Is Not Cacheable?

Answer :

no-cache/no-store directive suggests that aid isn't cacheable.

Question 36. Which Directive Of Cache Control Header Of Http Response Can Set The Time Limit Of Caching?

Answer :

max-age directive suggests that the caching is legitimate up to max-age in seconds. After this, consumer has to make some other request.

Java Abstraction Interview Questions
Question 37. Which Directive Of Cache Control Header Of Http Response Provides Indication To Server To Revalidate Resource If Max-age Has Passed?

Answer :

have to-revalidate directive provides indication to server to revalidate useful resource if max-age has handed.

Question 38. What Are The Best Practices For Caching?

Answer :

Always keep static contents like snap shots, css, JavaScript cacheable, with expiration date of two to three days. Never preserve expiry date too high.
Dynamic contents need to be cached for few hours simplest.

Question 39. What Are The Best Practices To Be Followed While Designing A Secure Restful Web Service?

Answer :

As RESTful internet offerings work with HTTP URLs Paths so it's miles very important to protect a RESTful internet provider inside the identical way as a internet site is be secured. Following are the first-class practices to be observed whilst designing a RESTful internet carrier:

Validation − Validate all inputs at the server. Protect your server towards SQL or NoSQL injection attacks.
Session based authentication − Use session based totally authentication to authenticate a consumer on every occasion a request is made to a Web Service approach.
No sensitive information in URL − Never use username, password or session token in URL , these values must be surpassed to Web Service via POST approach.
Restriction on Method execution − Allow limited use of techniques like GET, POST, DELETE. GET method must not be capable of delete facts.
Validate Malformed XML/JSON − Check for properly shaped input exceeded to a web provider method.
Throw everyday Error Messages − A web carrier technique ought to use HTTP error messages like 403 to reveal get right of entry to forbidden etc.
Question forty. What Is The Purpose Of Http Status Code?

Answer :

HTTP Status code are standard codes and refers to predefined status of mission executed at server. For example, HTTP Status 404 states that requested resource isn't always present on server.

Amazon Web Services (AWS) Interview Questions
Question forty one. What Http Status Code 2 hundred States?

Answer :

It method, OK, suggests fulfillment.

Question 42. What Http Status Code 201 States?

Answer :

It approach, CREATED, whilst a resource is a success created the use of POST or PUT request. Return hyperlink to newly created useful resource the use of region header.

RESTful JAVA Web Services Interview Questions
Question forty three. What Http Status Code 204 States?

Answer :

It method, NO CONTENT, when response frame is empty for instance, a DELETE request.

Question forty four. What Http Status Code 304 States?

Answer :

It means, NOT MODIFIED, used to lessen community bandwidth usage in case of conditional GET requests. Response frame ought to be empty. Headers ought to have date, area and so forth.

Question forty five. What Http Status Code four hundred States?

Answer :

It method, BAD REQUEST, states that invalid enter is supplied e.G. Validation mistakes, missing statistics.

Question forty six. What Http Status Code 401 States?

Answer :

It way, FORBIDDEN, states that consumer is not getting access to technique getting used for instance, delete get right of entry to without admin rights.

Question forty seven. What Http Status Code 404 States?

Answer :

It approach, NOT FOUND, states that method is not to be had.

Question 48. What Http Status Code 409 States?

Answer :

It means, CONFLICT, states war state of affairs at the same time as executing the technique as an example, including replica access.

Question 49. What Http Status Code 500 States?

Answer :

It method, INTERNAL SERVER ERROR, states that server has thrown some exception while executing the method.

Question 50. What Is Jax-rs?

Answer :

JAX-RS stands for JAVA API for RESTful Web Services. JAX-RS is a JAVA primarily based programming language API and specification to provide assist for created RESTful Webservices. Its 2.0 model changed into launched in 24 May 2013. JAX-RS makes heavy use of annotations available from Java SE 5 to simplify development of JAVA primarily based internet offerings advent and deployment. It additionally provides supports for developing customers for RESTful net offerings.




CFG