Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It's important to understand the distinction between what REST provides and what REST doesn't care about.</p> <ul> <li><p>A RESTful service provides a minimal set of actions which a client can use (providing it knows the correct data format) to manipulate a class of resources</p> <ul> <li>For example, you should be able to POST to <code>/resourceA/12345</code> to edit that existing resource</li> </ul></li> <li><p>A RESTful service doesn't make any guarantees about which other URLs will return meaningful responses.</p> <ul> <li><p>One notable example is that REST doesn't specify that <code>/resourceA/12345/edit</code> will return an HTML form designed for editing that resource. That's a feature of the HTML application that simply provides a method of performing the POST described above.</p></li> <li><p>Extending this theory, it's perfectly acceptable to have multiple edit forms which all POST to the defined RESTful URL. Since the controller's <code>edit</code> action will generally use <code>.attributes = ...</code> to mass-assign whatever it's passed, you can look at the attributes passed in, along with information about which HTML button was used to submit the form, to decide which page the user should see next.</p></li> <li><p>It may be scary relying on one controller method to deal with multiple page's submissions, but with clever validation and selectively overwriting accessors, you can maintain a lot of control over how users access the app.</p></li> <li><p>You should also be able to work out that this method doesn't restrict users to only sending attributes in the order presented in the form. Another RESTful client could in theory POST updates for <em>all</em> attributes associated with a resource, rather than just those presented by one page of your wizard. Assuming your model methods are robust enough everything can be made to Just Work.</p></li> </ul></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload