CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Ruby & Ruby On Rails (http://www.codingforums.com/forumdisplay.php?f=44)
-   -   Can someone explain to me what is "RESTful" (http://www.codingforums.com/showthread.php?t=261428)

Keysle 05-15-2012 07:33 PM

Can someone explain to me what is "RESTful"
 
I wiki'd it and my mind was blown. I suppose the process of defining it comes with what angle of perception the learner is coming from.

I know some PHP and some MySQL.
I can store stuff, and echo stuff. Loop through arrays and make session and cookie variables. Oh yeah, send emails too. These tid bits of knowledge can get one surprisingly far, but I'm still lost when it comes to the meaning of "RESTful". Can someone explain it to someone with my background?

kaizenfury7 06-01-2012 09:25 AM

When it comes to Ruby on Rails, RESTful is a way for writing web services.

For instance, let's say you want to build an RESTful api to manage cars:

http://host/cars - when you do a GET on this URL, you should get a list of cars
http://host/cars/1 - when you do a GET on this URL, you are tring to get a car that has the ID of 1
http://host/cars/1 - when you do a PUT on this URL, it means you are trying to update the car with the ID of 1
http://host/cars/1 - when you do a DELETE on this URL, it means you are trying to delete the car with the ID of 1

This isn't the only way of doing this, you can custom design your API and name things however you want or use whatever method (GET/PUT/POST/DELETE) you want to try to do those 4 actions (list, read, update, delete). However, the REST way follows some principles that allows you and third parties to interact more easily with your API because of the assumptions it makes.

Here's there definition from the Ruby on Rails docs:
http://guides.rubyonrails.org/getting_started.html#rest

annaharris 09-17-2012 09:33 AM

One big part of the whole restful thing is that you should use the different HTTP methods to represent different actions. Here you can find brief tutorial on creating RESTful web services using the Ruby on Rails framework : http://www.youtube.com/watch?v=J6r_l3cAS9s

bparker1084 12-05-2012 06:44 AM

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.

misteroram01 12-05-2012 07:07 AM

The Restful Objects specification defines a set of RESTful resources, and corresponding JSON representations, for accessing and manipulating a domain object model.


All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.