On Sun, May 16, 2010 at 11:22 AM, Luciano Resende <[email protected]> wrote: > I'd like to start working on defining a more robust API to access > photoArk galleries, I'm planning to start by creating a new module > (most likely a copy of current photark module) to avoid disrupting the > current web application. I'd start by applying REST with JSON as the > default wire format, and once we are ok with the new API, we could > start migrating the existent app to use this new API. > > Thoughts ? >
I have started playing with a REST API for PhotArk at my sandbox [1]. I have started by introducing a clear separation of Model and Services, and you can see that I created things like Gallery, Album and Image as pure model objects. This will makes things clear and improve performance by allowing more atomic client/server communications with the Gallery/Album services. The second area is applying REST and Hypermedia principles to our API, and the idea is that client (such as our UI) would interact with the PhotArk gallery treating it as resources, and a call to retrieve GET http://localhost:8085/gallery would get a response similar to : { "albums": [ { "ref": "http://localhost:8080/gallery/album1", "name": "Album 1", "coverImageRef": null }, { "ref": "http://localhost:8080/gallery/album2", "name": "Album 2", "coverImageRef": null } ] } Note that this initial response has all the information to build the "gallery index" with a list of all available albums, and also provides direct link to calling further service api to retrieve extra information (e.g the album details via album:ref attribute ). Please let me know your thoughts on this, and if people are ok with this direction, I'll start investigating what's the best way to integrate this to trunk. [1] http://svn.apache.org/repos/asf/incubator/photark/sandbox/lresende/photark-rest/ -- Luciano Resende http://people.apache.org/~lresende http://twitter.com/lresende1975 http://lresende.blogspot.com/
