jueves, 11 de agosto de 2011

Creating "REST" APIs with django

I've been trying to implement an API for our service with some django based frameworks for the last week and to be honest the experience hasn't been as placent as I expected.

These are the frameworks that I evaluated and the reasons that made me get away or make use of them:
  • piston: the project looks abandoned and it is not compatible with latest django version (because of automatic csrf checks).  It seems to be very used with hundreds of forks but none of them convinced me.   Its strongest points are OAuth support and being used for the bitbucket API.
  • tastypie: the project is actively maintained and looks very nice but I had some problems as soon as I tried to implement things a bit different than usual.  I didn't like the concept of hydrating/dehydrating objects. In addition it has some external dependencies and I didn't like very much the way it is coded when I looked at the source code.
  • djangorestframework: it looks less featured but simpler and actively maintained.   It also took me some time to implement things that were a bit different from the usual use case, but it was finally my choice.  It source code is clean and easy to understand.
During this evaluation process I also found this table with info about different  implementations that could be useful.   There are also a lot of stackoverflow questions about this issue.