Introduction

REST is a web architecture and not a technology/specification in itself.
Multiple frameworks and/or specification meanwhile enable resources to be accessed and manipulated via the REST concepts.

MinuteProject 4 REST will then not be bound to a particular framework. Since v0.5.3.
REST-style architecture consisting of client server, MinuteProject 4 REST will be dual.
  • Server: wrap REST backend on distinct technology stack that support it in their architecture.
  • Client: provide a sample client that consumes REST WebService.
    • jQuery

Practically MinuteProject 4 REST generates 'restified' backends and an associated client application (the same for all the backend frameworks).


REST URLs
Here is the naming convention used by MinuteProject for the different 'restified' frameworks so that they proposed same:
  • URLs structure for server;
  • URLs structure for a client application (here html jQuery testing page);
  • message format in xml an json to render backend data.

Remark:
The first version of MinuteProject 4 Rest with Grails and Playframework offer a simple functionality: search on primary key.
Later version, will bring additional functionalities.
Ideally, a complete MVC application could run on the browser and not on the server.

Server URLs

<contextRoot>/rest/xml/<entity plurialized>/<primary key value>
<contextRoot>/rest/json/<entity plurialized>/<primary key value>

Client URLs

<contextRoot>/rest/client/xml/<entity plurialized>
<contextRoot>/rest/client/json/<entity plurialized>


Testing RESTFull applications

MinuteProject will generate (for each database entity (table or view)) simple HTML pages whose purpose is to make an ajax call to a REST URL and then display the received information.
The information format can either be xml or json.
JQuery is the javascript framework that will perform the ajax call and the display.

Flow: json client

Go to a client entity URL. Ex for 'Item' entity with a json format: /rest/client/json/items
jQueryRestXmlItemsClient.jpg
Add a primary key value (ex 1) in the textfield
Click on the link
jQueryRestXmlItemsClientResult1.jpg
The 'Item' description are appended.

Behind the scene, jQuery send a ajax call to /pet/rest/json/items/1 (1 been the primary key value)
That returns a json message
{"item":
[{
"itemid":1
,"name":"Friendly Cat"
,"description":"This black and white colored cat is super friendly.
Anyone passing by your front yard will find him puring at their feet and trying to make a new friend.
His name is Anthony, but I call him Ant as a nickname since he loves to eat ants and other insects."
,"imageurl":"images/anthony.jpg"
,"imagethumburl":"images/anthony-s.jpg"
,"price":307.1
,"totalscore":15
,"numberofvotes":3
,"disabled":2
}]}
And then display it.

Flow: xml client
Go to a client entity URL. Ex for 'Item' entity with a json format: /rest/client/xml/items

The behavior is the same as the json client, except that jQuery is emitting the ajax call to /pet/rest/xml/items/1 and the message return has an xml structure.