Modelling restful properties


I’ve recently been playing with Liberty and JAX-RS and in an effort to remember some of what I’ve discovered, I’m going to try and keep a few notes and post them here, probably along with a few questions. If anyone else finds them useful, or knows the answers, that’s a bonus!!

To start with Creating an efficient REST API with HTTP provides a nice overview of REST APIs and JAX-RS basics has a great simple sample application to get going with… and break!

JAXRSServiceModel_Main

Armed with the basics I thought it would be interesting to model the sample application to compare the working code with what Rational Software Architect (RSA) would generate for me. Obviously that’s not the most complex model in the world but it was good to have a few examples to follow:

(Those articles made much more sense when I’d tracked down all the likely looking JAXRS, REST and UML features in the RSA installer!)

Before generating any code, it was quite nice to get some basic API documentation out of the model. Not as fancy as using Swagger UI but certainly better than no documentation!

systemproperties-apidoc

It’s only a start but that’s all for part 1. Hopefully there’ll be more posts at some point when I get further, probably along these lines:

  • Creating an OSGi Web project and generating some code
  • Using a REST client to check it works, including a puzzling Wink problem
  • Adding some debug
  • Expanding the sample with some awkward long running processing
  • Deploying to Bluemix
  • Anything else I encounter along the way!

If you know of any good articles/books/fancy new media that would help, please leave recommendations below. If there are better ways to design REST services (Swagger looks interesting but I haven’t had a chance to investigate), please share them. And any other tips, comments, or questions of your own are also very welcome!

 

Advertisement

RESTful house


Possibly a little premature (not sold the current house yet!) but I’ve been pondering the opportunity for playing with home automation when we find a new house.

Not even having the house yet means I have a completely blank canvas so I’m on the look out for ideas. On the hardware side, Nigel has mentioned Arduino a few times which sounds pretty interesting, plus there’s the Slug option. Laptops seem to get used too but I’d rather avoid that. On the where to start side, Andy’s house uses MQTT, is in Second Life, Twitters, and has a pretty worrying power meter graph, which should provide a few ideas! He’s not the only one- it would seem that IBMers like their home automation projects. Like Glenn, low cost is high on my list of requirements (I will have just undergone open wallet surgery buying a house!) although I suspect my idea of low is lower than Glenn’s! I also want it to be low power- very low power, so I’m pondering some sort of mesh approach to avoid any kind of server… as such… just because really! I quite like the idea of giving the house a REST interface. I don’t want any fans. So a clear set of requirements there then.

Any thoughts, suggestions, success/horror stories?