views:

229

answers:

2

In short, I am writing an Android application that I want to have pull data from a remote database. I was looking into .NET web services, but this http://stackoverflow.com/questions/297586/how-to-call-web-service-with-android question pointed me away from that direction.

Is REST as simple as writing some short PHP to handle something like https://www.example.com/data.php?employee=michael and have it return relevant XML or JSON data? That to me seems like what has been described to me by various sites and videos. Also, is this the best way to do this kind of operation over the internet for mobile devices, desktop applications, etc?

+3  A: 

What you describe is pretty much what REST is about. Perhaps, however the URL to michael employee could be something like that:

https://www.example.com/employees/michael

Anyway, the idea with REST is that resources are exposed through URLs and that everything is stateless. This is a very good model to use in order to pull data from a database. It can be used both from mobile as well as desktop applications.

kgiannakakis
This is a sufficient answer to get you started. However, I suggest you try to become more familiar with the specific concepts of REST. You do need some understanding of the theory to do REST right. For example, you should understand all of REST's constraints and what it means to apply only some of them.As an introduction I suggest http://www.infoq.com/articles/rest-introduction and http://www.infoq.com/articles/rest-anti-patternsFor a more in depth treatment of the tradeoffs regarding the constraints see http://nordsc.com/ext/classification_of_http_based_apis.html
Jan Algermissen
Thanks for the responses! How would I go about creating a resource that uses a URL like https://www.example.com/employees/michael or https://www.example.com/employees/john and have it search the database for those names? I'm only used to using GET and POST.
MGSoto
A: 

What you are discussing is only a small part of what REST is about. For simply pulling raw data from a database a HTTP based - Type I system is probably sufficient for your needs.

Darrel Miller