symfony2 server design pattern best practice - rest

So I'm about to create a mobile application using titanium. I want to use Symfony2 as the server and communicate via rest API's with the client (mobile)
What I am asking is what are the best practices when it comes to designing my server? and what do you recommend I start with?

Have a look at the FOSRestBundle or the Symfony REST Edition, this should get you started quickly.
https://github.com/FriendsOfSymfony/FOSRestBundle
https://github.com/gimler/symfony-rest-edition

As far as RESTful API endpoint design and the data your API will transfer, I really like this guide:
http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api
Granted, this is more of a generic "How do I REST API?" guide, but I think it's useful in a situation like yours.

Related

Need help getting started with making REST services using GAE

I've just started on a small project to create some REST services using Google App Engine and Java. I'm new to both technologies, but I've done some reading on both. I'm familiar with SOAP (have used them previously), and I think I understand the conceptual differences between REST and SOAP.
Currently I need info regarding two things:
1) I'm trying to find some tutorial which builds a simple REST service from scratch for deploying on Google App Engine (GAE). The simpler the better, but it should have at least a few routing options. I don't need any UI, if that matters.
2) Which RESTful Framework should I use with Google App Engine. Again, simplicity is what I'd like, and something which has tutorials and a newcomer can easily grasp.
My ultimate goal is to just write a REST wrapper with multiple routing options, which eventual consumes some pre-existing SOAP services and returns their results.
Have you checked out Google Cloud Endpoints for creating a REST service? Its pretty simple and straightforward, also has support for OAuth.
I would give Jello framework a try. It offers a clean, and simple to follow, JSON format and provides a very powerful and comprehensive RESTful implementation that follows the OData specification.
Here is Jello's REST development guide: http://jello-framework.com/guide/rest.html

How to provide a REST interface to a SOAP web service?

I know very little about web programming but I need to establish a license generation web service to provide licenses to users of my desktop software.
I have managed to create a working & debugged SOAP service on a Win2003 server but now I have discovered that the interface that I need to provide to my payment processor must be REST.
How would you recommend I deal with this, given that I simply don't have the time to learn PHP and rewrite my web service etc. I could bypass the SOAP altogether and easily create an executable which receives the license parameters and returns an encrypted license, but it's the web interface bit that I am stuck on. I will probably subcontract someone to write a utility for this on elance, but I don't know what to ask for.
Manu thanks,
Michael
You can expose the same service as SOAP based as well as RESTful. Axis2 with WSDL 2.0 has support for this.
Please see this article RESTful Web Services with Apache Axis2 - explains things in detail..
Thanks..
There's no easy conversion from SOAP to REST. SOAP WebServices RESTful APIs use different approaches. I think it is very easy to do with Ruby on Rails (which will take care of 90% of RESTful APi for you). All you need is to implement your logic.
Sinatra example:
get '/hi' do
"Hello World!"
end

why use rest api in what scenario is REST better? NoSQL

There are now REST apis for Mongodb and redis.
I can connect to those databases with my language's driver.
Or I can use the REST api. I understand that the REST api is easier to grok, and easier to convert from language to language. But there's less features.
But is there any reason to use the rest api if I'm already doing fine with the language driver?
Thanks.
In my opinion a RESTful API is useful when you have to integrate multiple different clients in heterogenous environments. It's also good when you need features that are already solved for HTTP – like caches or load-balancing.
REST resources are supposed to capture use-cases of your application. I find it highly unlikely that an API to a database would do that for you. Mostly like the native language driver is the appropriate choice.
Rich web clients can talk directly to it, without any server side mediator. Also, for instance, if you have a JCR repository with NoSQL connector on hostA and NoSQL store on hostB, you're glad for RESTful api.

Recommendation required RESTful web services on Linux

Looking for a recommendation of which framework/web server to go with on Linux. The idea is to build database backed RESTful web services.
I know Java, c++, c# (irrelevant I guess on linux) and C. Okay with developing in any of those.
Here is a table of frameworks that have varying degrees of support for REST and the languages they use.
You might want to check out RESTx. It is multi lingual: You can write code in Java, Python (server-side JavaScript coming soon). RESTx is specifically a platform for the creation of RESTful resources and web services. It is NOT a traditional application framework. DB backed web services are actually a specialty of RESTx: You identify the reusable components you want (in this case a JDBC capable DB access component), and then just configure it through the RESTful API or by filling out a small form in a browser. As a result, you get a new RESTful web service, which encapsulates the query you specified when creating the new resource.
I'm the lead developer on RESTx, so if you have any questions, please contact me or visit our forums.
If I were you I would go with Ruby 1.9.2 + Rails 3
they're fun and you get to learn something new
ubuntu specific install guide: http://web2linux.com/installing-rails-3-on-ubuntu-10-04-lucid-lynx/
official RoR intro: http://edgeguides.rubyonrails.org/getting_started.html

What's the best way to learn server RESTful code?

I'm an experienced client application developer (C++/C#), but need to come up to speed quickly on writing server side code to perform RESTful interactions. Specifically, I need to learn how to exchange data with OpenSocial containers via the RESTful API.
The RESTWiki is a very good resource and then there is the classic "How I explained REST to my Wife".
However, don't forget to go read about it directly from the source, it is not as difficult a read as it may first seem.
And I am assuming you will be doing REST over HTTP so this will come in very handy.
Lastly, considering OpenSocial supports the Atom Publishing Protocol, this will be useful.
Enjoy.
RESTful Web Services
I found this this to be a good introduction to RESTful web apps, although it doesn't refer to OpenSocial containers.