Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Are there any good samples of web applications that consume restful web services?

I am developing a webapp with spring, and have come to the point of reading lists of elements and element details from a RESTful JSON api. I started developing as though I was using a database, creating services, model elements plus DAOS, but now I'm stuck on how to do a proper design here.

Should model objects hold a fromJson/toJson method and encapsulate themselves the serialization info? What should DAO objects do? Where should I keep WS specific info (urls, api keys, item names, etc.)?

Any good opensource apps would be nice.

share|improve this question

closed as off-topic by gnat, GlenH7, Corbin March, Yusubov, MichaelT Aug 21 '13 at 16:48

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, GlenH7, Corbin March, Yusubov, MichaelT
If this question can be reworded to fit the rules in the help center, please edit the question.

    
would recommend taking a look at Mike Amundsen and his work with rest and apis amundsen.com/blog twitter.com/mamund and Rest Fest 2013 is in September restfest.org –  cartalot Aug 21 '13 at 23:33

2 Answers 2

up vote 2 down vote accepted

I have a personal project, MultiBit Merchant, which is released under MIT license. It is arranged as a platform that provides a REST API to a number of downstream clients, one of which is the MultiBit Store. It behaves as a simple e-commerce platform.

It's in early development and has some background documentation that is worth reading to get a good grip on the design decisions - there are numerous further articles covering REST, HAL and more.

The technologies involved are Maven, Java, Dropwizard, Spring, Hibernate, JAX-RS, JDBC, OpenID, HMAC and so on. Design patterns include services, DAOs, DTOs (with JSON HAL representation) within a Hexagonal architecture.

When I get the chance I will move away from Hibernate to MongoDB which will greatly simplify things.

If you're looking for a reasonable sized project that covers a lot of ground it may be of some use. If you want to copy great chunks of the code and alter them for your own purposes you may find the Simple Scaffolding class helpful.

share|improve this answer
1  
Your project sounds more than interesting, and you use most of the technologies I use. I will certainly take my time to study it. Thanks! –  kelmer Aug 21 '13 at 15:32
    
wow - am completely in awe of what you have built. and kind of glad i dont code in java so i wont lose the next few days :-) seriously thanks so much for posting this - and please post on yr twitter sometimes to update your progress. –  cartalot Aug 21 '13 at 23:40
    
@cartalot No worries - when I make a significant update to something I tend to post on Twitter and G+. I'm always glad to receive feedback and patches too :-) –  Gary Rowe Aug 22 '13 at 9:40

Many companies which develop APIs also develop clients using different programming languages. For example, Twilio list of client libraries is quite impressive. Recaptcha libraries is another good example.

Many of those libraries being open sourced, you can see how they are accessing the API. It won't give you all the answers (since their role is very limited), but still would be a good starting point. For example, they would show how to reduce code duplication and boilerplate code when calling the RESTful API with different options.

For now, I can't remember any open sourced application which uses RESTful APIs. If I recall one, I'll edit my answer.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.