Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Welcome to the confusing world of what is and what is not REST. First I would suggest that you have been reading about REST in the wrong places. Try <a href="http://rest.blueoxen.net/cgi-bin/wiki.pl?FrontPage" rel="noreferrer">RESTWiki</a> as a good starting point.</p> <p>REST is not a great solution for delivering data services for your web app. "Web Services" (aka SOAP, XML-RPC, WSDL, HTTP-POX) may be good for that but the REST architectural style is much more oriented towards client-server scenarios than server-server scenarios.</p> <p>Stop thinking about what URLs look like. What they look like has much more to do with which server side framework you use to implement the RESTful service than the design of the service itself. The client should discover URLs from previously retrieved representations, so it really does not care what the URLs look like.</p> <p>Having said that, using your example URLs to try and distinguish what you believe should be different resources, I do have some other suggestions. </p> <p>Don't version resources. i.e. if you have a resource that is accessed by the url <code>http://example.org/TodaysWeather</code> don't ever create a resource at <code>http://example.org/V2/TodaysWeather</code>. There are lots of other better ways to version representations than creating a whole new resource. Search SO for lots of other discussions on this.</p> <p>As for creating different resources for different content-types, I believe that is a context specific decision. If your end-user is using a browser to access the REST service and they are sophisticated enough to understand the difference between JSON and XML then go ahead and create two resources. If it is a machine client then I would use content negotiation to get the required format.</p> <p>And finally, be careful out there, since REST became a buzzword du jour, there is far more mis-informed content around than there is valid content.</p>
 

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