![]() |
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? |
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 |
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
|
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.
|
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.