2

I'm fairly new to web development in general.

Why would one want to implement REST api?
Whats the advantage of using a package to create a RESTful API interface

I return JSON to mobile devices and HTML to browsers but I don't think this counts as you need to support multiple serializations (XML, YAML, Plists, or JSONP in addition to JSON)

and none of those reasons listed there would be a reality for me in short time.
(I suspect not that many websites would be qualified for the reasons either.) Yet I see so many SO questions about REST api.

It gets me wonder What would be the dominating reasons a web developer would start implementing REST API?

I guess the confusion in me is due to my lack of understanding what REST is.. I read what seems to be the easiest introduction to what rest is.
http://tomayko.com/writings/rest-to-my-wife
What exactly is RESTful programming?

So REST is? - below is my understanding.

You expose your resource by URL. (/user/3)
Client can apply different verbs(GET/POST/PUT/DELETE) to the resource(URL) in order to access/manipulate the resource.

I can do that without using tastypie or django-piston.(I'm using django as my web framework)
What does these packages(in general, there seems to be similar package for PHP, JAVA.. etc) buy you?

In short, I am curious,

  1. When a regular web developer need to care about REST API?
  2. Because REST is (what)?
Community
  • 1
  • 1
eugene
  • 39,839
  • 68
  • 255
  • 489

2 Answers2

0

You are right, REST is mainly about using HTTP properly. Doing so without any framework is just as good, just as RESTful. I think the whole point of REST is that there is no magic involved, just HTTP.

Frameworks/libraries might save you from re-implementing some boilerplate code, and give you convenience methods. So I would not rule them out completely if I were you. When you start factoring out common code, you might end up re-implementing one of those libs :-)

For example on a project that uses SpringMVC already, adding some JSON REST services for AJAX requests is just a matter of annotating the controller.

Szocske
  • 7,466
  • 2
  • 20
  • 24
0

I can do that without using tastypie or django-piston.(I'm using django as my web framework) What does these packages(in general, there seems to be similar package for PHP, JAVA.. etc) buy you?

If you're working with Django I would highly recommend you work with one of the API frameworks. I'd suggest you look at either django-tastypie or django-rest-framework, as piston seems to now be unmaintained.

It's not strictly necessary, but it could end up saving you a huge amount of time, as they both include all sorts of useful support for serialization, authentication, permissions, throttling, and much much more. If you roll your own API it's likely that you'll end up duplicating a lot of the work the either of those frameworks do for you.

They'll also help by giving you a sensible structure to work against by providing the right abstractions for building Web APIs, so you don't need to think about everything from first principles.

Tom Christie
  • 33,394
  • 7
  • 101
  • 86