0

I don't exactly know what RESTFUL is. Sure I know it's a mapping of a URL to a resource. But how's that different from an ajax call to a codeigniter URL which echos some JSON?

My application will have subscriptions with states/options, is there any reason I should be using a RESTful setup rather than just some ajax calls when a user switches some of the options for their subscriptions?

2
  • rest is all about transfer of state! if you're implying that you just want to be able to invoke some method on the server for switching options on a subscription, you're more referring to a RPC style of programming. Apr 6, 2012 at 16:53
  • Easy. RESTful means stateless. All the information needed to do the "operation" is sent in that one single command. The server can come up and go down between calls and a RESTful operation doesn't care. Apr 6, 2012 at 16:54

1 Answer 1

3

You should not necessarily use "pure" REST. If your requirements drive you towards an HTTP-based service returning JSON, then great. But that doesn't imply that you need other aspects of the REST architectural style. You may not need:

  1. An architecture based on resources, in the sense they're defined by the HTTP protocol
  2. A URL structure that maps to resources
  3. You may not want the return result from one request to provide a set of URLs which indicate "where to go" for related requests.

REST is an architectural style, but it can also become a "religion". Be certain that whatever you do is driven by the requirements you need to fulfill, and not based on "ideology".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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