REST

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

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."

What are the best practices to be followed while designing a secure RESTful web service?

"As RESTful web services work with HTTP URLs Paths so it is very important to safeguard a RESTful web service in the same manner as a website is be secured. Following are the best practices to be followed while designing a RESTful web service − Validation − Validate all inputs on the server. Protect your server against SQL or NoSQL injection attacks. Session based authentication − Use session based authentication to authenticate a user whenever a request is made to a Web Service method. No sensitive data in URL − Never use username, password or session token in URL , these values should be passed to Web Service via POST method. Restriction on Method execution − Allow restricted use of methods like GET, POST, DELETE. GET method should not be able to delete data. Validate Malformed XML/JSON − Check for well formed input passed to a web service method. Throw generic Error Messages − A web service method should use HTTP error messages like 403 to show access forbidden etc."

What are the HTTP methods supported by REST?

"HTTP methods supported by REST are: •GET: It requests a resource at the request URL. It should not contain a request body as it will be discarded. May be it can be cached locally or on the server. •POST: It submits information to the service for processing; it should typically return the modified or new resource •PUT: At the request URL it update the resource •DELETE: At the request URL it removes the resource •OPTIONS: It indicates which techniques are supported •HEAD: About the request URL it returns meta information"

What are REST and RESTful Web Services?

"REST represents REpresentational State Transfer; it is relatively new aspect of writing web api. RESTFUL is referred for web services written by applying REST architectural concept are called RESTful services, it focuses on system resources and how state of resource should be transported over HTTP protocol to a different clients written in different language. In RESTFUL web service http methods like GET, POST, PUT and DELETE can be used to perform CRUD operations."

Mention some key characteristics of REST?

"Some key characteristics of REST includes •REST is stateless, so there is no storage of session data on the client •With a well applied REST API, the server could be restarted between two calls as every data is passed to the server •Web service mostly uses POST method to make operations, whereas REST uses GET to access resources"

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

"Testing tools for web services for REST APIs includes •Spring REST web service using MVC •Jersey API •CXF •Axis •Restlet"

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 is differences between RESTful web services and SOAP web services ?

"Though both RESTful web series and SOAP web service can operate cross platform they are architecturally different to each other, here is some of differences between REST and SOAP: REST is more simple and easy to use than SOAP REST uses HTTP protocol for producing or consuming web services while SOAP uses XML. REST is lightweight as compared to SOAP and preferred choice in mobile devices and PDA's. REST supports different format like text, JSON and XML while SOAP only support XML. REST web services call can be cached to improve performance."

What is URI?

"URI stands for Uniform Resource Identifier. Each resource in REST architecture is identified by its URI. Purpose of an URI is to locate a resource(s) on the server hosting the web service. A URI is of following format − <protocol>://<service-name>/<ResourceType>/<ResourceID>"

What is messaging in RESTful webservices?

A client sends a message in form of a HTTP Request and server responds in form of a HTTP Response. This technique is termed as Messaging. These messages contain message data and metadata i.e. information about message itself.

What is statelessness in RESTful Webservices?

As per REST architecture, a RESTful web service should not keep a client state on server. This restriction is called statelessness. It is responsibility of the client to pass its context to server and then server can store this context to process client's further request. For example, session maintained by server is identified by session identifier passed by the client.

What is JAX-WS and JAX-RS?

Both JAX-WS and JAX-RS are libraries (APIs) for doing communication in various ways in Java. JAX-WS is a library that can be used to do SOAP communication in JAVA, and JAX-RS lets you do the REST communication in JAVA.

What is the purpose of HTTP Status Code?

HTTP Status code are standard codes and refers to predefined status of task done at server. For example, HTTP Status 404 states that requested resource is not present on server.

What HTTP Status Code 400 states?

It means, BAD REQUEST, states that invalid input is provided e.g. validation error, missing data.

What HTTP Status Code 201 states?

It means, CREATED, when a resource is successful created using POST or PUT request. Return link to newly created resource using location header.

What HTTP Status Code 403 states?

It means, FORBIDDEN, states that user is not having access to method being used for example, delete access without admin rights.

What HTTP Status Code 500 states?

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

What HTTP Status Code 204 states?

It means, NO CONTENT, when response body is empty for example, a DELETE request.

What HTTP Status Code 404 states?

It means, NOT FOUND, states that method is not available.

What HTTP Status Code 200 states?

It means, OK, shows success.

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.

Which markup language can be used in restful web api?

JSON and XML are the two markup language that can be used in Restful web api

Which protocol is used by RESTful webservices?

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

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.


Set pelajaran terkait

2.4 Reading: Apply Information Literacy Skills to Web Searches

View Set

Ch.8: Survey Research, an overview

View Set

Religion Chapter 6: The Resurrection of Jesus Christ

View Set

Sherpath Lesson Ch. 15, 16, 17: Ears, Nose, and Throat

View Set

Chapter 27: Management of Patients with Coronary Vascular Disorders

View Set

Ch. 12 Principles of test selection and administration

View Set