Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is RESTful/REST [duplicate]

What's the difference between a REST system and a system that is RESTful?

From a few things I've read most so called REST services are actually RESTful services. So what is the difference between the two.

like image 259
AwkwardCoder Avatar asked Oct 14 '09 20:10

AwkwardCoder


People also ask

What is REST Idempotent?

One of the important aspects of REST (or at least HTTP) is the concept that some operations (verbs) are idempotent. As Gregor Roth said several years ago: The PUT method is idempotent. An idempotent method means that the result of a successful performed request is independent of the number of times it is executed.

How do I avoid the same request for multiple times to the server?

You can't stop the user from resubmitting a new request with the same ticket, but you can reject it on the server side, with a "Duplicate request" error. Right, but people do that on purpose - submit a form, press back because they know they need to correct something, submit form again.

What are the different types of REST resource?

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.

What is REST API v2?

The REST API provides a way for third parties to connect to a PagerDuty account and access or manipulate configuration data on that account. It is not for connecting your monitoring tools to send events to PagerDuty; for that, use the Events API.


16 Answers

Representational state transfer (REST) is a style of software architecture. As described in a dissertation by Roy Fielding, REST is an "architectural style" that basically exploits the existing technology and protocols of the Web.

RESTful is typically used to refer to web services implementing such an architecture.

like image 193
Justin Ethier Avatar answered Oct 26 '22 12:10

Justin Ethier


REST based Services/Architecture vs. RESTFUL Services/Architecture

To differentiate or compare these 2, you should know what REST is.

REST (REpresentational State Transfer) is basically an architectural style of development having some principles:

  • It should be stateless

  • It should access all the resources from the server using only URI

  • It does not have inbuilt encryption

  • It does not have session

  • It uses one and only one protocol - HTTP

  • For performing CRUD operations, it should use HTTP verbs such as get, post, put and delete

  • It should return the result only in the form of JSON or XML, atom, OData etc. (lightweight data )

REST based services follow some of the above principles and not all

RESTFUL services means it follows all the above principles.

It is similar to the concept of:

Object oriented languages support all the OOP concepts, examples: C++, C#

Object-based languages support some of the OOP features, examples: JavaScript, VB


Example:

ASP Dot NET MVC 4 is REST-Based while Microsoft WEB API is RESTFul.

MVC supports only some of the above REST principles whereas WEB API supports all the above REST Principles.

MVC only supports the following from the REST API

  • We can access the resource using URI

  • It supports the HTTP verb to access the resource from server

  • It can return the results in the form of JSON, XML, that is the HTTPResponse.

However, at the same time in MVC

  • We can use the session

  • We can make it stateful

  • We can return video or image from the controller action method which basically violates the REST principles

That is why MVC is REST-Based whereas WEB API supports all the above principles and is RESTFul.

like image 44
Pramod Nikumbh Avatar answered Oct 26 '22 13:10

Pramod Nikumbh


"REST" is an architectural paradigm. "RESTful" describes using that paradigm.

like image 40
SingleShot Avatar answered Oct 26 '22 12:10

SingleShot


As Jason said in the comments, RESTful is just used as an adjective describing something that respects the REST constraints.

like image 26
Darrel Miller Avatar answered Oct 26 '22 14:10

Darrel Miller


REST stands for representational state transfer. That means that state itself is not transferred but a mere representation of it is. The most common example is a pure HTML server based app (no javascript). The browser knows nothing about the application itself but through links and resources, the server is able transfer the state of the application to the browser. Where a button would normally change a state variable (e.g. page open) in a regular windows application, in the browser you have a link that represents such a state change.

The idea is to use hypermedia. And perhaps to create new hypermedia types. Potentially we can expand the browser with javascript/AJAX and create new custom hypermedia types. And we would have a true REST application.

This is my short version of what REST stands for, the problem is that it is hard to implement. I personally say RESTful, when I want to make reference to the REST principles but I know I am not really implementing the whole concept of REST. We don't really say SOAPful, because you either use SOAP or not. I think most people don't do REST the way it was envisioned by it's creator Roy Fielding, we actually implement RESTful or RESTlike architectures. You can see his dissertation, and you will find the REST acronym but not the word RESTful.

like image 27
Arturo Hernandez Avatar answered Oct 26 '22 14:10

Arturo Hernandez


REST is an style of software architecture for distributed software

Conforming to the REST constraints is referred to as being ‘RESTful’.

Very used today to build web services as an alternative to SOAP.

Here you have some links to check

http://en.wikipedia.org/wiki/Representational_State_Transfer
http://www.computerworld.com/s/article/297424/Representational_State_Transfer_REST_
http://www.ibm.com/developerworks/webservices/library/ws-restful/

like image 32
Claudio Redi Avatar answered Oct 26 '22 12:10

Claudio Redi


thanks for the answers. Read this article by Alex Rodriguez which suggests that a RESTful web service has 4 basic characteristics which are:

  1. Use HTTP methods explicitly.
  2. Be stateless.
  3. Expose directory structure-like URIs.
  4. Transfer XML, JavaScript Object Notation (JSON), or both.
like image 25
Kumait Avatar answered Oct 26 '22 13:10

Kumait


Representational State Transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web. The term Representational State Transfer was introduced and defined in 2000 by Roy Fielding1[2] in his doctoral dissertation. Fielding is one of the principal authors of the Hypertext Transfer Protocol (HTTP) specification versions 1.0 and 1.1. Conforming to the REST constraints is referred to as being ‘RESTful’. Source:Wikipedia

like image 35
Andersson Melo Avatar answered Oct 26 '22 14:10

Andersson Melo


Web services are essentially web sites whose content is consumed by computer programs, not people. REST is a set of architectural principles that stipulate that web services should maximally leverage HTTP and other web standards, so that programs gain all the good stuff that people already can get out of the web. REST is often contrasted with SOAP web services, and other "remote procedure call" oriented web services.

Stefan Tilkov's presentations on REST at Parleys.com are quite good, especially this one.

For a book, you can't get any better than Richardson and Ruby's Restful Web Services.

like image 26
Jim Ferrans Avatar answered Oct 26 '22 12:10

Jim Ferrans


A service based on REST is called a "RESTful service".

Source I rely on posting that: Dr.Dobbs Archive

like image 44
nickolay Avatar answered Oct 26 '22 12:10

nickolay


There are 4 levels of API defined in the Richardson Maturity Model. These are defined as:

  • level 0: any system that has a single endpoint for all its apis(SOAP or RPC fall in this category). Level 0 apis can also resemble "commands".

  • level 1: a ResourceUri described system. This is a system that defines multiple entity-based URIs (instead of having a single endpoint like a level 0 systems would). These URIs can use different http actions (POST, GET, PUT, etc) to implement different actions against that resource.

  • level 2: aka level 1 w/ a compliant use of Standard HTTP methods/verbs and multi status code responses

  • level 3: aka level 2 plus HATEOAS (hypermedia included in the response which describes additional calls you can make)

While levels 1, level 2, and level 3 can be considered as REST systems, only the stricter levels (aka level 2 and level 3) are considered to be RESTful.

So essentially all RESTful apis are REST apis, but not all REST apis are RESTful

definition of the Richardson Maturity Model

like image 33
Andrew Norman Avatar answered Oct 26 '22 13:10

Andrew Norman


Think of REST as an architectural "class" while RESTful is the well known "instance" of that class.

Please mind the ""; we are not dealing with "real" programming objects here.

like image 33
Pat Avatar answered Oct 26 '22 12:10

Pat


REST(REpresentation State Transfer) is an architecture using which WebServices are created.

and

RESTful is way of writing services using the REST architectures. RESTful services exposes the resources to identify the targets to interact with clients.

like image 40
Manas Avatar answered Oct 26 '22 12:10

Manas


Coming at it from the perspective of an object oriented programming mindset, REST is analogous to the interface to be implemented, and a RESTfull service is analogous to the actual implementation of the REST "interface".

REST just defines a set of rules that says what it is to be a REST api, and a RESTfull service follows those rules.

Allot of answers above already laid out most of those rules, but I know one of the big things that is required, and in my experience often overlooked, as that a true REST api has to be hyperlink driven, in addition to all of the HTTP PUT, POST, GET, DELETE jazz.

like image 40
DudeGuy Avatar answered Oct 26 '22 13:10

DudeGuy


A "REST service" and a "RESTful service" are one and the same.

A RESTful system is any system that follows the REST conventions as defined in the original document that created the idea of RESTful networked applications.

It's worth noting there are varying levels of RESTfulness. Overall, REST is a style, not a standard, so there is room for interpretation based on needs. one example is hierarchical resource URLs (e.g. /things/ID/relatedthings) vs flat URLs (e.g. /things/ID and /relatedthings?thing=ID)

like image 22
Brenden Avatar answered Oct 26 '22 12:10

Brenden


REST is an architectural pattern for creating web services. A RESTful service is one that implements that pattern.

like image 36
sajadre Avatar answered Oct 26 '22 13:10

sajadre