REST

Ace your homework & exams now with Quizwiz!

Explain the architectural style for creating web api?

The architectural style for creating web api are •HTTP for client server communication •XML/JSON as formatting language •Simple URI as the address for the services •Stateless communication

What does @RequestParam do?

This annotation representations a specific request parameter in our example, we map a request parameter called key to an argument key of type String.

What does @RequestBody do?

This annotation represents the body of the request, in our case, maps the body of the request to a POJO class of type.

What does it mean to code on demand?

This is the optional part of a RESTful web service. Most of the time, you will be sending static representations of resources in forms of XML or JSON.

How does having client-server make rest services truly restful?

This means that the server and client side should be able to evolve or be developed on without any dependency on each other.

What does 403 status code mean?

Forbidden

What does 400 status code mean?

It means bad request with invalid input.

What does it mean to be stateless?

It means that all client-server interactions are stateless. Server will not store anything about latest HTTP request client made. It will treat each and every request as new.

Explain how JAXB related to RESTful web api?

JAXB stands for Java API for Xml Binding. This framework is used to bind XML or JSON to Java objects without the need for creating XML or JSON parsers.

What does @RestController do?

Marks the class as a Resource and implies both @Controller and @ResponseBodyMVC annotations.

What does 204 code mean?

No content when the body is empty for example, when a DELETE method is used.

What does 404 status code mean?

Not found, method not available

What are RESTFul methods?

POST, GET, PUT, DELETE

What is the difference between PUT and POST?

""PUT"puts a file or resource at a particular URI and exactly at that URI. If there is already a file or resource at that URI, PUT changes that file or resource. If there is no resource or file there, PUT makes one POST sends data to a particular URI and expects the resource at that URI to deal with the request. The web server at this point can decide what to do with the data in the context of specified resource

What are the core components of a HTTP Request?

"A HTTP Request has five major parts − Verb − Indicate HTTP methods such as GET, POST, DELETE, PUT etc. URI − Uniform Resource Identifier (URI) to identify the resource on server. HTTP Version − Indicate HTTP version, for example HTTP v1.1 . Request Header − Contains metadata for the HTTP Request message as key-value pairs. For example, client ( or browser) type, format supported by client, format of message body, cache settings etc. Request Body − Message content or Resource representation.

List out the tools or API for developing or testing web api?

"Testing tools for web services for REST APIs includes •Spring REST •Jersey (Oracle) •CXF (Apache) •Restlet •REST Easy (JBOSS)"

What does it mean by Layered System

REST allows you to design a layered system architecture where you deploy server A and store data on server B and authenticate requests in server C. A client cannot tell whether it connected to the end or an intermediary.

What is REST?

REST is a web service architecture for designing loosely coupled application over HTTP that is often used in the development of web services.

How did RESTful services become predominant?

REST is easy to understand. It uses HTTP and easy to understand CRUD operations. Makes efficient use of bandwidth, as it's much less verbose than SOAP. Also designed to be purely stateless, and REST reads can be cached for better performance and scalability. REST supports many data formats, but predominantly uses JSON. It means that it has better support for browser clients.

When should you use REST over SOAP?

1. Developing a public API 2. Extensive back and forth object information 3. Your API requires quick developer response.

What makes a RESTful service truly RESTful?

1. Uniform interface 2. Client-server 3. Stateless 4. Cacheable 5. Layered System 6. Code on Demand

What are possible HTTP response codes?

100- Information ready 200 - success 300 - redirect error 400 - client error 500 - server error

What are annotations in Spring for RESTFul services?

@RestController @RequestMapping @RequestParam @RequestBody

What is Cacheable and why is it good for web services such as rest?

Caching is to store memory away for future use. Most webpages you are viewing are a cached version and the reason for this is for performance reasons and better scope for scalability for servers to reduce load. In REST, caching can be applied on both server side or client side.

What does @RequestMapping do?

Defines the URL of the resource in addition to the method type: GET/POST in our example we expose the payment service as POST which is accessed through/payment/pay.

What does 404 error mean?

File not found error

What does REST stand for?

Representational State Transfer.

What are resources in a REST architecture?

Resources are identified by logical URLs; it is the key element of a RESTful design. Unlike, SOAP web services in REST, you view the product data as a resource and this resource should contain all the required information.

What does 201 code mean?

Successfully created a new resource using put or post.

What is uniform interface?

you MUST decide which API interface for resources inside system which are exposed to API consumers and follow religiously. A resource in system should follow only one logical URI(universal resource identifier), and then should provide a way to fetch related or additional data.


Related study sets

BSAT 382 Ch. 8, EXAM 2 Questions, BSAT 382 Ch. 6, BSAT 382 Chapter 6 questions, BSAT 382 ch 8, BSAT 382 Ch 8, Operations Management, BSAT 382 - Managing Quality, BSAT 382 Chapter 8 questions, Operations Management Exam 2, Operations Management Exam 2...

View Set

CIS 3030 Session 2-2 Quick check

View Set

RN Comprehensive online practice 2019 A with NGN

View Set

Ch. 8 - one, Marketing Ch. 7 - one, Marketing Ch. 7 - two, Marketing Ch. 8 - two, Marketing Ch. 9 - one, Marketing Ch. 10 - one, Marketing Ch. 9 - two, Marketing Ch. 10 - two

View Set

47. Variable Interest Entities (VIEs)

View Set