Spring Rest Interview Questions

Ace your homework & exams now with Quizwiz!

How do we upload a document using Restful Web Services?

@POST

What is URI and how do you define in URI for restful web services?

REST APIs use Uniform Resource Identifiers to address resources Syntax: scheme:[//authority]path[?query][#fragment]

What is REST Console?

REST Console is a Request Visualizer and Constructor tool that helps developers build, debug and test RESTful API's

What is a Resource in Rest?

REST architecture treats every content as a resource. These resources can be text files, html pages, images, videos or dynamic business data. REST Server simply provides access to resources and REST client accesses and modifies the resources. Here each resource is identified by URIs/ global IDs.

Rest Representations?

REST uses various representations to represent a resource like text, JSON and XML, JSON being the most common

If you have to develop web services, are you using SOAP or REST?

REST: Variety of Data formats, Low Bandwidth (high performance), easy to understand HTTP SOAP: WS-Security, built-in retry logic (in rest we must reconnect), Can't cache connection limit, built in ACID properties, Function driven WSDL

QueryParam vs. PathParam

QP: Binds the values of a HTTP query param to a resource method parameter resource class field or bean property PP: Binds value of URI template parameter to a resource method parameter {}

What are the steps to expose business functionality as Restful Web Service?

1. Create Rest Resource 2. Add service method mapped against HTTP methods 3. Configure and deploy

How do we secure REST API

1. HTTPS 2. Hashing (cannot expose important properties) 3. Never expose in URL 4. OAUTH to protect

How do you address throttling to ensure a Restful API performs well under spikes in calls?

1. Rate limiting 2. IP level 3. Concurrent connection limit 4. Resource level

HTTP status codes?

1XX - informational 2XX - success 3XX - redirection 4/5XX - client / server error

REST Architecture?

A Rest Server simply provides access to resources and REST client accesses and presents the resources Resources are ID'd by URIs

What is Messaging in Restful Web Services?

A client sends a message in the form of an HTTP Request and server responds in the form of an HTTP response. Messages contain message data and metadata

What are Web Services?

A web service is a collection of open protocols and standards used for exchanging data between applications or systems. Apps can use web services to exchange data over the internet similar to inter-process communication on a single computer.

Rest vs. AJAX

AJAX: Set of tech, dynamically updating UI without reloading page. Eliminates interaction between customer and server REST: URL structure and a request/response pattern revolve around use of resources. Type of software architecture and a method for users to request data from servers Requires interaction between the customer and the server

What is Addressing in Restful Web Services?

Addressing refers to locating a resource or multiple resources lying on the server

What is API?

Application Programming Interface. One piece of software that allows client/server communication.

How do we secure Restful web services?

Basic authentication HMAC OAuth/SSO

Difference between RPC or document style web services?

DSWS: transport xml message as part of SOAP request, most appropriate where XML messages behave as document and content of that document can alter

Different methods available in Restful web services?

Get, put, post, delete, head, patch

What are resources in a Rest Architecture

ID'd by logical URLs and is the key element of RESTful design. Unlike SOAP we view the product data as a resource and this resource contains all required information

What is idempotent and which HTTP methods are idempotent in Restful web services?

It is a method that can be called many times without different outcomes Get, put, delete, head, options and trace Non-idempotent - POST

Mention which markup language used in Restful web api?

JSON and XML

JAXB related to RESTFUL web API?

Java Architecture for XML binding. Transform Java object to XML and vice versa

What are some types of API used?

Open, Partner and Private

PUT vs. POST

PUT: puts file at particular URI and if there is a file already there PUT changes, otherwise will create one (also idempotent) POST: Sends data and expects resources to deal with request, web server decides what it does with the data in the context or specified resource (non-idempotent)

What is the difference between POST and PUT?

Post is used to create resource and it is non-idempotent Put is used to update/modify the resource and it is idempotent HTTP method

How do we test REST API?

Postman, SoapUI, etc.

Difference between @Produces and @Consumes

Produces: used to specify MIME media type or represents a resource that can produce and send back to the client (array of String of MIME types) Consumes: Used to specify which MIME media types of a representation a resource can accept, or consume, from the client

Which Protocol is Used by Restful Web Services?

RESTful web services use the HTTP protocol as a medium of communication between the client and the server.

What are Restful Web Services and which framework do you use to develop?

Representational State Transfer Architectural style for designing distributed systems Not a standard but set of constraints (being stateless, having client / server relationship and uniform interface Works on HTTP methods (get post put delete) Provides status codes

What are the Rest Principles?

Resources expose easily understood directory structure URIs Representations transfer JSON or XML to represent data objects and attributes Messages use HTTP methods explicitly Stateless interactions store no client context on the server between requests. State dependencies limit and restrict scalability. Client holds session state.

What is Rest?

Rest is a web standards based architecture and uses HTTP protocol for Data Communication It revolves around resources where every component is a resource and a resource is accessed by a common interface using HTTP Standard Methods

SOAP vs. REST?

SOAP: Protocol where 2 computers communicate by sharing and XML document, permits only XML, reads cannot be cached, closely connected to the server, slower despite running on HTTP REST: Service architecture and design for network based software architectures, supports many data formats, reads can be cached, rest clients are more like browser and knows how to standardize methods, Faster and uses HTTP headers to hold meta information

List top development and testing tools for REST API?

SOAPUI, Postman, Rest Console

Different application integration styles?

Shared DB, Batch File Transfer, RPC, MOM

Principles of Rest API Continued:

Stateless, Client-Server, Uniform Interface, Cacheable, Layered System, Code on Demand

Key Characteristics of REST?

Stateless, server has no state or session data Server could be restarted between 2 calls Mostly use POST method to make operations wheras REST uses GET to access resources

Core Components of a HTTP Response

Status/Response Code HTTP Version Response Header Response Body

Best Practices to Design a Resource Representation?

Understandability- both Server and Client should b e able to understand and utilize the representation format of the resource Completeness- Format should be able to represent a resource completely Linkability- A resource can have a linkage to another resource, format should be able to handle such situations

What is the Purpose of HTTP Verb in Rest Based Web Services?

VERB ID's the operation to be performed on the resource

What are the Core Components of a HTTP Request?

Verb (GET, Post, delete, put, etc.) URI- Uniform resource Identifier (to identify resource on server) HTTP Version Request Header- Metadata for the HTTP Request message as key - value pairs Request Body- message content or resource representation

Benefits of Statelessness in Restful Web Services?

Web Services can treat each method request independently Web services need not to maintain client's previous interactions (simplifies app design) HTTP itself is stateless protocol so Rest works seamlessly with HTTP protocol

What are the disadvantages of Statelessness in Restful web services?

Web services need to get extra information in each request and then interpret to get the client's state in case client interactions are to be taken care of


Related study sets

Health and Illness Concepts I-Quiz-Elimination: Bowel

View Set

Chapters 5 and 6 How to Code in C

View Set

Module 6: Quantitative Job Evaluation Methods

View Set

Config Advanced Windows server 2, Midterm.

View Set