<div dir="ltr">&gt;<span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">If you use headers they should start with X-My-Header. So it is separated of the standard headers and marked as extension.</span><div style>
<span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">Please correct me if I&#39;m wrong,  but I thought that the &quot;X-&quot; header prefix were deprecated (</span><font color="#500050" face="arial, sans-serif"><a href="http://tools.ietf.org/html/rfc6648">http://tools.ietf.org/html/rfc6648</a>) and not advised. But this is all up the to implementor of the Route and you can name then what ever you like. </font></div>
<div style><font color="#500050" face="arial, sans-serif"><br></font></div><div style><font color="#500050" face="arial, sans-serif">Thanks, </font></div><div style><font color="#500050" face="arial, sans-serif"><br></font></div>
<div style><font color="#500050" face="arial, sans-serif">/Dan</font></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 11 January 2013 13:39, Kris Borchers <span dir="ltr">&lt;<a href="mailto:kris@redhat.com" target="_blank">kris@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div class="im"><div>On Jan 11, 2013, at 6:36 AM, Daniel Manzke &lt;<a href="mailto:daniel.manzke@googlemail.com" target="_blank">daniel.manzke@googlemail.com</a>&gt; wrote:</div>
<br><blockquote type="cite"><div dir="ltr">I have to say I like all proposals. Having access to the informations in the json is the facebook way. It is easy to build an graph explorer. No need to get low level.<div><br></div>
<div>On the other hand, if you want to be more consistent, I would go the way of the last proposal. I think this is in a more common sense to http. Think about the Range header, which is used for downloading. </div>

<div>You specify what part you want to have.</div><div><br></div><div>If you use headers they should start with X-My-Header. So it is separated of the standard headers and marked as extension.</div></div></blockquote><div>
<br></div></div>+1 on &quot;X-&quot; prefix.<div class="im"><br><blockquote type="cite"><div dir="ltr"><div><br></div><div>Last but not least, I always like the Content-Negotiation way, where you can have a url like &quot;.../download/myfile.pdf&quot; which would translate to only accept pdfs (@Produces). It can also be used for sending xml instead of json. (default with json &quot;/cars&quot; and specific would be &quot;/cars.json&quot; or &quot;/cars.xml&quot;.</div>
</div></blockquote><div><br></div></div>What is this XML you speak of? (Sorry, ignore the comments from the JavaScript guy :P)<div><div class="h5"><br><blockquote type="cite"><div dir="ltr">

<div><br></div><div><br></div><div>Bye,</div><div>Daniel</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/1/11 Kris Borchers <span dir="ltr">&lt;<a href="mailto:kris@redhat.com" target="_blank">kris@redhat.com</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div><div>On Jan 11, 2013, at 5:01 AM, Daniel Bevenius &lt;<a href="mailto:daniel.bevenius@gmail.com" target="_blank">daniel.bevenius@gmail.com</a>&gt; wrote:</div>


<br><blockquote type="cite"><div dir="ltr">Hey Kris, <div><br></div><div>been thinking about your reply regarding the inconsistency of the returned data. I think it looks a little odd to have the &#39;cars&#39; property returned when requesting a single car.</div>



<div>What do you all think of this as a suggestion below?</div></div></blockquote><div><br></div></div>I&#39;m sorry, I misread that e-mail and thought these were both requests to the /cars endpoint and the data returned was formatted differently based on the data length. What you have makes sense so disregard what I said.</div>


<div><div><br><blockquote type="cite"><div dir="ltr"><div><br></div><div>As you can see we now return HTTP Headers and also the object returned is either an array of cars, or just a single object if you only request a single car. </div>



<div><br></div><div><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:16px">Getting a page of Cars</span><br></div><div><div style="border:none;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">



<pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span style="color:rgb(0,128,128)">URL</span><span style="font-weight:bold">=</span><span style="color:rgb(221,17,68)">&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo" target="_blank">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo</a>&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> <span style="color:rgb(221,17,68)">&quot;$URL/cars?page=0&amp;perPage=4&quot;</span>
</pre></div><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">The request will return:</p><div style="border:none;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">



<pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span>HTTP</span><span style="font-weight:bold">/</span><span style="color:rgb(0,153,153)">1.1</span> <span style="color:rgb(0,153,153)">200</span> <span>OK</span>
<span>Link</span><span style="font-weight:bold">-</span><span>Previous</span><span style="font-weight:bold">:</span> <span>cars</span><span style="font-weight:bold">?</span><span>page</span><span style="font-weight:bold">=</span><span style="color:rgb(0,153,153)">0</span><span style="font-weight:bold">&amp;</span><span>page</span><span style="font-weight:bold">=</span><span style="color:rgb(0,153,153)">4</span>
</pre></div></div></div></blockquote></div>IMO, if we are on the first page the Link-Previous header should be empty since there is no previous page. That will make it easier for people building the UI to know if they should show a previous link, etc. Also, you can&#39;t have two parameters with the same name, should that actually be page=0&amp;perPage=4?<br>


<blockquote type="cite"><div dir="ltr"><div style="border:none;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span>Link</span><span style="font-weight:bold">-</span><span>First</span><span style="font-weight:bold">:</span> <span>cars</span><span style="font-weight:bold">?</span><span>page</span><span style="font-weight:bold">=</span><span style="color:rgb(0,153,153)">0</span><span style="font-weight:bold">&amp;</span><span>page</span><span style="font-weight:bold">=</span><span style="color:rgb(0,153,153)">4</span>
</pre></div></div></blockquote>Same thing, page/perPage?<div><br><blockquote type="cite"><div dir="ltr"><div style="border:none;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">


<pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span>MetaData</span><span style="font-weight:bold">-</span><span>PerPage</span><span style="font-weight:bold">:</span> <span style="color:rgb(0,153,153)">4</span>
<span>MetaData</span><span style="font-weight:bold">-</span><span>Page</span><span style="font-weight:bold">:</span> <span style="color:rgb(0,153,153)">0</span>
<span>Link</span><span style="font-weight:bold">-</span><span>Next</span><span style="font-weight:bold">:</span> <span>cars</span><span style="font-weight:bold">?</span><span>page</span><span style="font-weight:bold">=</span><span style="color:rgb(0,153,153)">1</span><span style="font-weight:bold">&amp;</span><span>page</span><span style="font-weight:bold">=</span><span style="color:rgb(0,153,153)">4</span>
</pre></div></div></blockquote></div>Same as previous, if we are on the last page, there should not be a value for Link-Next. Also, as above, page/perPage?<div><div><br><blockquote type="cite"><div dir="ltr">

<div><div style="border:none;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span>Content</span><span style="font-weight:bold">-</span><span>Type</span><span style="font-weight:bold">:</span> <span>application</span><span style="font-weight:bold">/</span><span>json</span><span>;</span><span>charset</span><span style="font-weight:bold">=</span><span>UTF</span><span style="font-weight:bold">-</span><span style="color:rgb(0,153,153)">8</span>
<span>Content</span><span style="font-weight:bold">-</span><span>Length</span><span style="font-weight:bold">:</span> <span style="color:rgb(0,153,153)">161</span>
<span>[</span>
  <span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Black&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;BMW&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">1</span><span>},</span>
  <span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Red&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Ferrari&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">2</span><span>},</span>
  <span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Blue&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Skoda&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">3</span><span>},</span>
  <span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Green&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Audi&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">4</span><span>}</span>
<span>]</span>
</pre></div><h4 style="margin:20px 0px 10px;padding:0px;font-size:16px;font-family:Helvetica,arial,freesans,clean,sans-serif"><a name="13c299fc7cfe1a8e_13c2994b6c3cc16a_getting-the-next-page-of-cars" href="https://gist.github.com/4500336#getting-the-next-page-of-cars" style="color:rgb(65,131,196);text-decoration:initial;display:block;padding-left:30px" target="_blank"></a></h4>



<h4 style="margin:20px 0px 10px;padding:0px;font-size:16px;font-family:Helvetica,arial,freesans,clean,sans-serif">Get a single Car</h4><div style="border:none;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">



<pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span style="color:rgb(0,128,128)">URL</span><span style="font-weight:bold">=</span><span style="color:rgb(221,17,68)">&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo" target="_blank">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo</a>&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> <span style="color:rgb(221,17,68)">&quot;$URL/cars/1&quot;</span>
</pre></div><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">The request will return:</p><div style="border:none;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">



<pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Black&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;BMW&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">1</span><span>}</span></pre>



</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 10 January 2013 20:00, Daniel Bevenius <span dir="ltr">&lt;<a href="mailto:daniel.bevenius@gmail.com" target="_blank">daniel.bevenius@gmail.com</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Summers brought up a good point today on IRC which I&#39;ve forgot to mention. We&#39;ve said that it will be possible to pass the page parameters as HTTP Headers and this is still the plan. But the demo is using the lastest from upstream and support for passing headers to the client is not there yet. I hope to have this working shortly though and I&#39;ll post back with information as soon as possible, tomorrow or Monday at the latest.<div>




<br></div><div><br></div></div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On 10 January 2013 15:32, Daniel Bevenius <span dir="ltr">&lt;<a href="mailto:daniel.bevenius@gmail.com" target="_blank">daniel.bevenius@gmail.com</a>&gt;</span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>&gt;<span style="font-family:arial,sans-serif;font-size:13px">I know it&#39;s just a demo but I think making that JSON format consistent so that the car data is always in an array under the &quot;cars&quot; key would be better.</span></div>




<div>
<font face="arial, sans-serif">Good point. I&#39;ll change this so that there is always a &quot;cars&#39; key.</font></div></div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
On 10 January 2013 15:13, Kris Borchers <span dir="ltr">&lt;<a href="mailto:kris@redhat.com" target="_blank">kris@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div><div>On Jan 10, 2013, at 3:02 AM, Daniel Bevenius &lt;<a href="mailto:daniel.bevenius@gmail.com" target="_blank">daniel.bevenius@gmail.com</a>&gt; wrote:</div>





<br><blockquote type="cite"><div dir="ltr">We talked about paging yesterday on IRC, and it was decided to add a paging example to aerogear-controller-demo. What follows is an example to kick of further discussion about what the example should look like.<br>






<div><br></div><div><h2 style="margin:0px 0px 10px;padding:0px;font-size:24px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(204,204,204);font-family:Helvetica,arial,freesans,clean,sans-serif">






</h2><h2 style="margin:0px 0px 10px;padding:0px;font-size:24px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(204,204,204)"></h2><h2 style="margin:0px 0px 10px;padding:0px;font-size:24px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(204,204,204)">






AeroGear Controller Demo Paging Route</h2><p style="margin:0px 0px 15px;font-size:14px;font-weight:normal;line-height:22px">This page discusses <a href="https://issues.jboss.org/browse/AEROGEAR-795" style="color:rgb(65,131,196);text-decoration:initial" target="_blank">AEROGEAR-795</a> which is about adding an example to aerogear-controller-demo to demonstrate paging support so that the client libraries (Android, JavaScript, and iOS) can be tested against it.</p>
<p style="margin:15px 0px;font-size:14px;font-weight:normal;line-height:22px">This is only a suggestion and the implementation and the names of the query parameters can all be changed.</p><h3 style="margin:20px 0px 10px;padding:0px;font-size:18px">






Use case</h3><p style="margin:0px 0px 15px;font-size:14px;font-weight:normal;line-height:22px">The example is using cars as the resource to interact with. To be able to query we need something to query, so lets start by adding some cars by posting.</p>






<h4 style="margin:20px 0px 10px;padding:0px;font-size:16px">Adding Cars</h4><div style="border:none;padding:0px;font-size:14px;font-weight:normal;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span style="color:rgb(0,128,128)">URL</span><span style="font-weight:bold">=</span><span style="color:rgb(221,17,68)">&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo" target="_blank">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo</a>&quot;</span>

curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> -H <span style="color:rgb(221,17,68)">&quot;Content-type: application/x-www-form-urlencoded&quot;</span> --data <span style="color:rgb(221,17,68)">&quot;car.color=Black&amp;car.brand=BMW&quot;</span> -X POST <span style="color:rgb(221,17,68)">&quot;$URL/cars&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> -H <span style="color:rgb(221,17,68)">&quot;Content-type: application/x-www-form-urlencoded&quot;</span> --data <span style="color:rgb(221,17,68)">&quot;car.color=Red&amp;car.brand=Ferrari&quot;</span> -X POST <span style="color:rgb(221,17,68)">&quot;$URL/cars&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> -H <span style="color:rgb(221,17,68)">&quot;Content-type: application/x-www-form-urlencoded&quot;</span> --data <span style="color:rgb(221,17,68)">&quot;car.color=Blue&amp;car.brand=Skoda&quot;</span> -X POST <span style="color:rgb(221,17,68)">&quot;$URL/cars&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> -H <span style="color:rgb(221,17,68)">&quot;Content-type: application/x-www-form-urlencoded&quot;</span> --data <span style="color:rgb(221,17,68)">&quot;car.color=Green&amp;car.brand=Audi&quot;</span> -X POST <span style="color:rgb(221,17,68)">&quot;$URL/cars&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> -H <span style="color:rgb(221,17,68)">&quot;Content-type: application/x-www-form-urlencoded&quot;</span> --data <span style="color:rgb(221,17,68)">&quot;car.color=Yello&amp;car.brand=Opel&quot;</span> -X POST <span style="color:rgb(221,17,68)">&quot;$URL/cars&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> -H <span style="color:rgb(221,17,68)">&quot;Content-type: application/x-www-form-urlencoded&quot;</span> --data <span style="color:rgb(221,17,68)">&quot;car.color=Pink&amp;car.brand=Mini&quot;</span> -X POST <span style="color:rgb(221,17,68)">&quot;$URL/cars&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> -H <span style="color:rgb(221,17,68)">&quot;Content-type: application/x-www-form-urlencoded&quot;</span> --data <span style="color:rgb(221,17,68)">&quot;car.color=Gray&amp;car.brand=Nissan&quot;</span> -X POST <span style="color:rgb(221,17,68)">&quot;$URL/cars&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> -H <span style="color:rgb(221,17,68)">&quot;Content-type: application/x-www-form-urlencoded&quot;</span> --data <span style="color:rgb(221,17,68)">&quot;car.color=Red&amp;car.brand=Volvo&quot;</span> -X POST <span style="color:rgb(221,17,68)">&quot;$URL/cars&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> -H <span style="color:rgb(221,17,68)">&quot;Content-type: application/x-www-form-urlencoded&quot;</span> --data <span style="color:rgb(221,17,68)">&quot;car.color=Blue&amp;car.brand=Saab&quot;</span> -X POST <span style="color:rgb(221,17,68)">&quot;$URL/cars&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> -H <span style="color:rgb(221,17,68)">&quot;Content-type: application/x-www-form-urlencoded&quot;</span> --data <span style="color:rgb(221,17,68)">&quot;car.color=Black&amp;car.brand=Mazda&quot;</span> -X POST <span style="color:rgb(221,17,68)">&quot;$URL/cars&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> -H <span style="color:rgb(221,17,68)">&quot;Content-type: application/x-www-form-urlencoded&quot;</span> --data <span style="color:rgb(221,17,68)">&quot;car.color=Yello&amp;car.brand=Golf&quot;</span> -X POST <span style="color:rgb(221,17,68)">&quot;$URL/cars&quot;</span>
</pre></div><p style="margin:15px 0px;font-size:14px;font-weight:normal;line-height:22px">The example uses an in-memory database so the data will be cleared upon redployment/restart of the server. So you only need to populate/post when you&#39;ve restared or redployed.</p>
<p style="margin:15px 0px;font-size:14px;font-weight:normal;line-height:22px">With the cars in place, we can now issue GET requests with paging query parameters. The following route has been added to the demo:</p><div style="border:none;padding:0px;font-size:14px;font-weight:normal;line-height:22px">






<pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span>route</span><span style="font-weight:bold">()</span>
      <span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">from</span><span style="font-weight:bold">(</span><span style="color:rgb(221,17,68)">&quot;/cars&quot;</span><span style="font-weight:bold">)</span>
      <span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">on</span><span style="font-weight:bold">(</span><span>RequestMethod</span><span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">GET</span><span style="font-weight:bold">)</span>
      <span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">produces</span><span style="font-weight:bold">(</span><span>MediaType</span><span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">JSON</span><span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">toString</span><span style="font-weight:bold">())</span>
      <span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">to</span><span style="font-weight:bold">(</span><span>Cars</span><span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">class</span><span style="font-weight:bold">).</span><span style="color:rgb(0,128,128)">get</span><span style="font-weight:bold">(</span><span>param</span><span style="font-weight:bold">(</span><span style="color:rgb(221,17,68)">&quot;page&quot;</span><span style="font-weight:bold">,</span> <span style="color:rgb(221,17,68)">&quot;0&quot;</span><span style="font-weight:bold">),</span> <span>param</span><span style="font-weight:bold">(</span><span style="color:rgb(221,17,68)">&quot;perPage&quot;</span><span style="font-weight:bold">,</span> <span style="color:rgb(221,17,68)">&quot;-1&quot;</span><span style="font-weight:bold">));</span>
</pre></div><p style="margin:15px 0px;font-size:14px;font-weight:normal;line-height:22px">From this we can see that there are two optional parameters, <code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">page</code> and <code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">perPage</code>. If these are not specified all cars will be returned.</p>






<h4 style="margin:20px 0px 10px;padding:0px;font-size:16px">Getting a page of Cars</h4><div style="border:none;padding:0px;font-size:14px;font-weight:normal;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span style="color:rgb(0,128,128)">URL</span><span style="font-weight:bold">=</span><span style="color:rgb(221,17,68)">&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo" target="_blank">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo</a>&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> <span style="color:rgb(221,17,68)">&quot;$URL/cars?page=0&amp;perPage=4&quot;</span>
</pre></div><p style="margin:15px 0px;font-size:14px;font-weight:normal;line-height:22px">The request will return:</p><div style="border:none;padding:0px;font-size:14px;font-weight:normal;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span>{</span>
  <span style="color:rgb(221,17,68)">&quot;metadata&quot;</span><span style="font-weight:bold">:</span><span>{</span><span style="color:rgb(221,17,68)">&quot;page&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">0</span><span>,</span><span style="color:rgb(221,17,68)">&quot;perPage&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">4</span><span>},</span>
  <span style="color:rgb(221,17,68)">&quot;cars&quot;</span><span style="font-weight:bold">:</span><span>[</span>
            <span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Black&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;BMW&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">1</span><span>},</span>
            <span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Red&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Ferrari&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">2</span><span>},</span>
            <span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Blue&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Skoda&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">3</span><span>},</span>
            <span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Green&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Audi&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">4</span><span>}</span>
          <span>],</span>
  <span style="color:rgb(221,17,68)">&quot;links&quot;</span><span style="font-weight:bold">:</span><span>{</span>
          <span style="color:rgb(221,17,68)">&quot;first&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;cars?page=0&amp;page=4&quot;</span><span>,</span>
          <span style="color:rgb(221,17,68)">&quot;previous&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;cars?page=0&amp;page=4&quot;</span><span>,</span>
          <span style="color:rgb(221,17,68)">&quot;next&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;cars?page=1&amp;page=4&quot;</span>
          <span>}</span>
<span>}</span>
</pre></div><h4 style="margin:20px 0px 10px;padding:0px;font-size:16px">Getting the next page of Cars</h4><p style="margin:0px 0px 15px;font-size:14px;font-weight:normal;line-height:22px">To get the next page you can follow the <code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">next</code> link:</p>






<div style="border:none;padding:0px;font-size:14px;font-weight:normal;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span style="color:rgb(0,128,128)">URL</span><span style="font-weight:bold">=</span><span style="color:rgb(221,17,68)">&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo" target="_blank">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo</a>&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> <span style="color:rgb(221,17,68)">&quot;$URL/cars?page=1&amp;perPage=4&quot;</span>
</pre></div><div style="border:none;padding:0px;font-size:14px;font-weight:normal;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span>{</span>
    <span style="color:rgb(221,17,68)">&quot;metadata&quot;</span><span style="font-weight:bold">:</span><span>{</span><span style="color:rgb(221,17,68)">&quot;page&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">1</span><span>,</span><span style="color:rgb(221,17,68)">&quot;perPage&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">4</span><span>},</span>
    <span style="color:rgb(221,17,68)">&quot;cars&quot;</span><span style="font-weight:bold">:</span><span>[</span>
            <span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Yello&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Opel&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">5</span><span>},</span>
            <span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Pink&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Mini&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">6</span><span>},</span>
            <span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Gray&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Nissan&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">7</span><span>},</span>
            <span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Red&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Volvo&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">8</span><span>}</span>
           <span>],</span>
    <span style="color:rgb(221,17,68)">&quot;links&quot;</span><span style="font-weight:bold">:</span><span>{</span>
            <span style="color:rgb(221,17,68)">&quot;first&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;cars?page=0&amp;page=4&quot;</span><span>,</span>
            <span style="color:rgb(221,17,68)">&quot;previous&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;cars?page=0&amp;page=4&quot;</span><span>,</span>
            <span style="color:rgb(221,17,68)">&quot;next&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;cars?page=2&amp;page=4&quot;</span>
            <span>}</span>
<span>}</span>
</pre></div><h4 style="margin:20px 0px 10px;padding:0px;font-size:16px">Get all Cars</h4><div style="border:none;padding:0px;font-size:14px;font-weight:normal;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span style="color:rgb(0,128,128)">URL</span><span style="font-weight:bold">=</span><span style="color:rgb(221,17,68)">&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo" target="_blank">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo</a>&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> <span style="color:rgb(221,17,68)">&quot;$URL/cars&quot;</span>
</pre></div><h4 style="margin:20px 0px 10px;padding:0px;font-size:16px">Get a single Car</h4><div style="border:none;padding:0px;font-size:14px;font-weight:normal;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span style="color:rgb(0,128,128)">URL</span><span style="font-weight:bold">=</span><span style="color:rgb(221,17,68)">&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo" target="_blank">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo</a>&quot;</span>
curl -i --header <span style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> <span style="color:rgb(221,17,68)">&quot;$URL/cars/1&quot;</span>
</pre></div><p style="margin:15px 0px;font-size:14px;font-weight:normal;line-height:22px">The request will return:</p><div style="border:none;padding:0px;font-size:14px;font-weight:normal;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span>{</span><span style="color:rgb(221,17,68)">&quot;color&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;Black&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;brand&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(221,17,68)">&quot;BMW&quot;</span><span>,</span><span style="color:rgb(221,17,68)">&quot;id&quot;</span><span style="font-weight:bold">:</span><span style="color:rgb(0,153,153)">1</span><span>}</span>
</pre></div></div></div></blockquote><div><br></div></div>Hmmm, the data returned should be consistent, right? Whether paging parameters are supplied or not, the structure of the JSON to access the car info should be the same. It&#39;s fine to leave out the metadata and links when they&#39;re not needed I guess but to access the car info, currently you have:</div>





<div><br></div><div>Not Paged: {&quot;color&quot;:&quot;Black&quot;,&quot;brand&quot;:&quot;BMW&quot;,&quot;id&quot;:1}</div><div>Paged: {&quot;cars&quot;:[{&quot;color&quot;:&quot;Black&quot;,&quot;brand&quot;:&quot;BMW&quot;,&quot;id&quot;:1},…]}</div>





<div><br></div><div>I know it&#39;s just a demo but I think making that JSON format consistent so that the car data is always in an array under the &quot;cars&quot; key would be better.<br><blockquote type="cite"><div>
<div dir="ltr"><p style="margin:15px 0px;font-size:14px;font-weight:normal;line-height:22px">Again, anything here can be changed, the name of the query parameters, the implementation, and what is returned.</p><p style="margin:15px 0px;font-size:14px;font-weight:normal;line-height:22px">






Reference:</p><ul style="margin-top:15px;margin-right:0px;margin-left:0px;padding:0px 0px 0px 30px;font-size:14px;font-weight:normal;line-height:22px;margin-bottom:0px!important"><li><a href="https://gist.github.com/4147473" style="color:rgb(65,131,196);text-decoration:initial;margin-top:0px" target="_blank">Paging Support in AeroGear Controller</a></li>






</ul></div></div><div>
_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">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>





</div></blockquote></div><br></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">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>
<br></blockquote></div><br></div>
</div></blockquote></div><br></div>
</div></blockquote></div><br></div>
_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">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></div></div><br></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">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>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Viele Grüße/Best Regards<br><br>Daniel Manzke
</div>
_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">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></div></div><br></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">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>
<br></blockquote></div><br></div>