<br><br>On Friday, September 14, 2012, Glen Daniels  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 9/13/12 11:25 PM, Douglas Campos wrote:<br>
&gt; Howdy!<br>
&gt;<br>
&gt; I was thinking on how to start this conversation on server contracts, so let&#39;s start with an example for a resource named &quot;car&quot; - all interactions are &#39;application/json&#39;.<br>
&gt;<br>
&gt; We talked on irc about how to maintain the bare minimum that would give us full agnostic server backends, and I&#39;ve tried to limit as CRUDL - CRUD + List without pagination :)<br>
&gt;<br>
&gt; C     POST            /cars<br>
&gt; R     GET             /car/1<br>
&gt; U     PUT             /car/1<br>
&gt; D     DELETE          /car/1<br>
&gt; L     GET             /cars<br>
&gt;<br>
&gt; Glen commented on irc that this would introduce coupling between the client and the server - but the point is that the endpoint style can and should be configurable in several levels:<br>
&gt;<br>
&gt; - always_plural? (/cars everywhere) [1]<br>
<br>
+1.  I don&#39;t think we should initially even care abut the above case,<br>
but only support &quot;/cars&quot; and &quot;/cars/1&quot;.<br>
<br>
&gt; - do we support batch operations? (as suggested by [1])<br>
<br>
By &quot;batch&quot; do you mean PUT to &quot;/cars&quot; to bulk-update the whole<br>
collection?  I don&#39;t think we need to do that initially either, as most<br>
REST APIs I&#39;ve seen don&#39;t support that.<br>
<br>
&gt; - logic name (/vehicles should be interpreted as &quot;cars&quot;)<br>
<br>
No need to do anything explicit about this, if I&#39;m understanding you<br>
correctly.  Taking a Java/Android example, if you want to play with<br>
cars, you could just do:<br>
<br>
pipe = new Pipe(&quot;vehicles&quot;, Car.class);</blockquote><div><br></div><div><br></div><span class="Apple-style-span" style>vehicles is a logical name on the client, for the /cars resource (due to the Car type), right?</span><div>
<span class="Apple-style-span" style><br></span></div><div><span class="Apple-style-span" style><br></span></div><div><span class="Apple-style-span" style>I tought he meant endpoint aliases <br></span></div><div><div><span class="Apple-style-span" style><br>
</span></div><div><span class="Apple-style-span" style>-M<span></span></span></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
In other words, specifying the URL for a given collection&#39;s root is up<br>
to the dev.<br>
<br>
&gt; - read-only routes?<br>
<br>
Not sure what this means?  Certainly authorization is a factor here.<br>
<br>
&gt; The point is, we can and should adapt to the most common scenarios - so an user should be able to use /signup instead of /register for auth endpoints - and there&#39;s what is a must for us IMO.<br>
<br>
...yes, but that still assumes that you send the same piece of JSON to<br>
your auth endpoint, right?  Or perhaps &quot;username&quot;/&quot;password&quot; form fields<br>
- but of course some of those also need a &quot;passwordConfirm&quot; param... or<br>
maybe a &quot;confirmPassword&quot; param... or OAuth... and that&#39;s when I think<br>
you start getting into hairy stuff.<br>
<br>
&gt; The user is using a &lt;insert your technology here&gt; server? if he supports http sessions we should be able to authenticate him, and here is where our challenge lies - being &quot;inclusive&quot; without making our APIs lame :)<br>

&gt;<br>
&gt; So, we need to figure out what is more common, and make this the default (or convention), while still allowing our users to choose different/weird conventions for their endpoints.<br>
&gt;<br>
&gt; Thoughts?<br>
<br>
Challenging.<br>
<br>
&gt; (Before I forgot, Glen asked about pagination too, and I think this should be layered on top of this basics, as in this case there is no standard way to do it)<br>
<br>
Like security, there are a few best practices / common patterns here<br>
too.  Examples:<br>
<br>
<a href="http://stackoverflow.com/questions/924472/paging-in-a-rest-collection" target="_blank">http://stackoverflow.com/questions/924472/paging-in-a-rest-collection</a><br>
<a href="http://stackoverflow.com/questions/776448/pagination-in-a-rest-web-application" target="_blank">http://stackoverflow.com/questions/776448/pagination-in-a-rest-web-application</a><br>
<a href="http://tools.ietf.org/html/rfc5005" target="_blank">http://tools.ietf.org/html/rfc5005</a><br>
<br>
--Glen<br>
<br>
_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;aerogear-dev@lists.jboss.org&#39;)">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
</blockquote></div><br><br>-- <br>Sent from Gmail Mobile<br>