RESTful URL's
RESTful operations on collections
Use pretty and RESTful URL’s.
GET /places
returns a list of all places
GET /places/new
returns a form to create a new place
POST /places
submits fields for creating a new place
Operate on a Record
GET /places/1
Returns place with id 1
DELETE /places/1
Destroys place with id 1
POST /places/1?_method=DELETE
Alias for DELETE, to compensate for browser limitations
GET /places/1/edit
Returns a form to edit the first record
PUT /places/1
Submits fields for updating the first record
POST /places/1?_method=PUT
Alias for PUT, to compensate for browser limitations
Follow a Relationship
GET /places/1/phones
Returns a collection of phone numbers associated with place with id 1
GET /places/1/phones/1
Returns phone number with id 1 associated with place with id 1
GET /places/1/phones/new
Returns a form to create a new phone number for place with id 1
POST /places/1/phones/
Submits fields to create a new phone number for place with id 1
GET /tickets/1/messages
Retrieves list of messages for ticket with id 1
PUT /tickets/1/messages/5
Updates message 5 for ticket 1
Invoke Custom Actions
It isn’t always possible to map everything into CRUD. Thus, there is also a syntax for specifying custom actions:
POST /places/1/rate
Runs the “rate” action against place with id 1
GET /tickets?sort=-priority
Retrieves a list of tickets in descending order of priority