It would be helpful to have a bit more detail about your needs. Are
you looking for general information on REST as a concept, the
particular implementation of REST in Rails, or do you need specific
information on the REST implementation of this website that you
For information on REST itself there are many articles available on
the web about this emerging standard. For information about Rails’
implementation of REST there’s a general overview in the “Agile Web
Develop with Rails” book. Another possibly good resource is the
screen casts over at Peepcode. I haven’t watched it yet, but I hear
it’s good. For a “Big Picture” view of REST and why Rails has begun
embracing it, watch DHH’s keynote here:
However, it sounds like you need to communicate with an existing REST
web service. That’s going to be dependent on that service’s
implementation of REST. Your best bet there is try to find
documentation on using their REST interface.
I’ve been seeing a lot of information on REST lately and much of it
seems very confused. There appears to be much confusion about what
REST really means.
I like to think about it this way:
First, put aside the idea that you are dealing with a database. The
database is just a repository to store and retrieve a set of
resources. Instead think about your application in terms of
Lets speak in terms of a “book” as one of your application’s
You want to perform a set of operations on books:
- Create new books.
- List all, or some, of the exiting books.
- Get one particular book.
- Make changes to existing books.
- Delete books.
In terms of Rails these operations might translate to the following
- POST: http://localhost:3000/books
- GET: http://localhost:3000/books
- GET: http://localhost:3000/books/123
- PUT: http://localhost:3000/books/123
- DELETE: http://localhost:3000/books/123
Notice how some of these URLs refer to your “collection” of books and
others refer to a particular member of the books collection.
Then there are a couple of additional URL needed to deal with
resources not directly related to book, but are needed due to the
nature of the web:
- GET: http://localhost:3000/books/new
- GET: http://localhost:3000/books;edit
I’m not quite sure why the Rails team decided to use “http://localhost:
3000/books/new” instead of “http://localhost:3000/books;new” but
that’s just something you have to remember. Those extensions to the
GET operations like “/new” or “;edit” can be thought of as “hints” to
your application that you are asking for the HTML form for either
entering a new book or modifying an existing book. The HTML forms can
be thought of as another type of resource in your application that you
Pretty much everything else in RESTful Rails is simply an extension to
these basic concepts. There are methods for generating the various
URLs like books_path() and books_url(). You can find a nice overview
of those in the free REST cheat sheet available from peepcode.com.
There is also the concept of “nested” resources, but I won’t go into
details on that here. There are other resources (I’ve mentioned a
few) that go into detail on those. They also discuss how to extend
your REST routes beyond the basic CRUD operations.
Hope that helps.