Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>it depends on the way you want to model your resources. It's perfectly possible that you'd never explicitly provide access to a single question, and would modify the entire survey document, like so:</p> <pre><code>PUT /surveys/123 &lt;survey&gt; &lt;link rel="update" href="/surveys/123" method="PUT" type="application/vnd.mycorp.survey+xml" /&gt; &lt;question id="age"&gt; &lt;label&gt;How old are you?&lt;/label&gt; &lt;select&gt; &lt;option&gt;0 - 5&lt;/option&gt; &lt;option&gt;6 - 10&lt;/option&gt; &lt;option&gt;10 - 13&lt;/option&gt; &lt;/select&gt; &lt;/question&gt; &lt;/survey&gt; </code></pre> <p>If you go this route, you could even use HTML, or HTML 5 for your content so it's easy to consume by clients. Now you're just modifying the entire survey document at once.</p> <p>Alternatively, you might want to separately address each question, giving them an individual URI, which I think is what you're talking about, like so:</p> <pre><code>GET /survey/123 &lt;survey&gt; &lt;link rel="add-question" href="/survey/123/questions" type="application/vnd.mycorp.surveyquestion+xml" method="POST" /&gt; &lt;question&gt; &lt;link rel="delete" href="/questions/123-age" method="DELETE" /&gt; &lt;link rel="update" href="/questions/123-age" type="application/vnd.mycorp.surveyquestion+xml" method="PUT" /&gt; &lt;label&gt;How old are you?&lt;/label&gt; &lt;select&gt; &lt;option&gt;0 - 5&lt;/option&gt; &lt;option&gt;6 - 10&lt;/option&gt; &lt;option&gt;10 - 13&lt;/option&gt; &lt;/select&gt; &lt;/question&gt; &lt;/survey&gt; </code></pre> <p>Neither of these is more RESTful than the other, the difference is only in granularity of call. If you need the granularity of the latter, then configure yourself a separate handler per resource as in </p> <pre><code>using(OpenRastaConfiguration.Manual) { ResourceSpace.Has.ResourcesOfType&lt;Survey&gt;().AtUri("/survey/{id}").HandledBy&lt;SurveyHandler&gt;(); ResourceSpace.Has.ResourcesOfType&lt;Question&gt;().AtUri("/questions/{id}").HandleBy&lt;QuestionHandler&gt;(); } </code></pre>
 

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