Hello again.

After reading some interesting posts about REST, specially

[1] REST APIs must be hypertext-driven
[2] Describing RESTful Applications

I started to think that my own RESTish implementation of a "service
midleware" wasn't very RESTish at all. Basically because it hadn't
that much of that HATEOAS constraint.

Now that was not a big problem because all the services implemented on
top of that "service layer" where a kind of  basic "request-response
only" where there were very few situations where I had to change from
a "state" returned by the service to another, subsequent state. It was
more like a "data-centric" access like

GET http://localhost:8080/rest/data/person/101

<person>
  <firstName>TONINHO</firstName>
  <lastName>METRALHA</lastName>
  <account>010123101</account>
</person>

and that is enough because that's all the info I need for now and it's
convenient to serialize/deserialize in Java using XStream. But of
course if it were a just litlle more complex example I start to loose
expandability and extensibility and restability...

So, based on [2] I was wondering in change my data a bit (actually a
few bits), like this

GET http://localhost:8080/rest/data/person/101

<person>
  <firstName>TONINHO</firstName>
  <lastName>METRALHA</lastName>
  <account href="http://localhost:8080/rest/data/bank/accounts/010123101
">010123101</account>
</person>

This way I keep the "data-centric" aspect of the service while getting
the benefits of HATEOAS when/where I need it.

Is this a good approach in the light of  HATEOAS?



Also, referring to [2], all that use of "extended" media-types, like

application/vnd.bank.org.account+xml

is a correct use of the concept of "hipertext as the engine of
application state"? Or putting in another way, the use of Media-Types
to describe the *structure* (as opposed to the *nature*) of a
data-centric response is correct, under a restfull point-of-view??


Thanks all.

[1] http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
[2] http://www.infoq.com/articles/subbu-allamaraju-rest

_______________________________________________

Melhores cumprimentos / Beir beannacht / Best regards

António Manuel dos Santos Mota

mobile PT: +351919623568 (deprecated)
mobile IE: +353(0)877718363
mail: [email protected]
skype: amsmota
msn: [email protected]
linkedin: www.linkedin.com/in/amsmota
_______________________________________________

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=999939

Reply via email to