Re: Creating REST APIs in Django...advice

2011-04-12 Thread Tom Christie
  The obvious big difference with REST framework is that the API is entirely 
web browse-able. To me that's quite a big deal - your API can be genuinely self 
documenting, and it's massively easier to browse, work with, and debug, than it 
would be if your working from the command line all the time.

  There's a bunch of other things I think it does well, from really nice error 
handling, using Django's class based views with mixin classes, and treating 
form and json etc input equally as regards validation, but I really need to sit 
down and write that stuff up properly sometime. (not got the time to go into it 
right now)

  And, yeah I would def use hidden form fields to set the method if you need 
web browser support for DELETE/PUT etc. It's a pretty common pattern, and it's 
much better than polluting your URL space specifically to cope with browser 
limitations.

  Cheers,
  Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Creating REST APIs in Django...advice

2011-04-12 Thread Brian Bouterse
This is an interesting approach I had not thought of before.  Thanks!

Agreed, CRUD is not the same as REST.

Brian

On Tue, Apr 12, 2011 at 10:51 AM, sebastien piquemal wrote:

> Well ... http://django-rest-framework.org  allows you to override the
> method by adding a post parameter. So in your form, you just add a
> hidden input
>
> 
>
> or
>
> 
>
> and django-rest-framework will pipe your POST request into the "put"
> handler or "delete" handler. Of course name="_method" can be
> configured (I mean that you can use another parameter name). That's a
> quite elegant way to overcome the limitation you are talking about
> (even though CRUD and REST are not exactly the same things).
>
> I am not sure that piston is still actively maintained ...
>
> On Apr 12, 3:57 pm, Brian Bouterse  wrote:
> > I've been reading through the documentation for piston and
> > django-rest-framework.org and they both look like great projects.  Could
> > anyone with experience working with either of these applications (or
> their
> > authors themselves) provide some compare and contrasting of the
> > features/usability/etc.
> >
> > Also, as a general REST-ism, the HTML
> > formtag doesn't
> > allow for HTTP methods besides GET and POST.  As such we
> > typically write a full REST API (GET, PUT, POST, DELETE), and then end up
> > doing the following to "make it work" for HTML/browser settings.
> >
> > CREATE - POST to /resource/
> > READ - GET to /resource/
> > UPDATE - POST to /resource/
> > DELETE - POST to /resource/delete
> >
> > The really non-restful part of the "make it work for browsers" hack is
> > adding the verb delete into the URL.  I couldn't think of a better way.
> >  This is a common pattern I end up implementing a lot, and it would be
> cool
> > if a rest framework let me accomplish this in an easier way.
> >
> > Brian
> >
> > On Tue, Apr 12, 2011 at 6:23 AM, Tom Christie  >wrote:
> >
> >
> >
> > > I've been working on this with some folks:
> >
> > >http://django-rest-framework.org
> >
> > > Released 0.1 a few weeks ago, and it's coming along *really* nicely.
> It's
> > > under v active development ATM. The auto-generated API browser is
> > > particularly cool. Really would advise anyone taking a look at building
> web
> > > APIs in python to take a look at it.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
> >
> > --
> > Brian Bouterse
> > ITng Services
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Creating REST APIs in Django...advice

2011-04-12 Thread sebastien piquemal
Well ... http://django-rest-framework.org  allows you to override the
method by adding a post parameter. So in your form, you just add a
hidden input



or



and django-rest-framework will pipe your POST request into the "put"
handler or "delete" handler. Of course name="_method" can be
configured (I mean that you can use another parameter name). That's a
quite elegant way to overcome the limitation you are talking about
(even though CRUD and REST are not exactly the same things).

I am not sure that piston is still actively maintained ...

On Apr 12, 3:57 pm, Brian Bouterse  wrote:
> I've been reading through the documentation for piston and
> django-rest-framework.org and they both look like great projects.  Could
> anyone with experience working with either of these applications (or their
> authors themselves) provide some compare and contrasting of the
> features/usability/etc.
>
> Also, as a general REST-ism, the HTML
> formtag doesn't
> allow for HTTP methods besides GET and POST.  As such we
> typically write a full REST API (GET, PUT, POST, DELETE), and then end up
> doing the following to "make it work" for HTML/browser settings.
>
> CREATE - POST to /resource/
> READ - GET to /resource/
> UPDATE - POST to /resource/
> DELETE - POST to /resource/delete
>
> The really non-restful part of the "make it work for browsers" hack is
> adding the verb delete into the URL.  I couldn't think of a better way.
>  This is a common pattern I end up implementing a lot, and it would be cool
> if a rest framework let me accomplish this in an easier way.
>
> Brian
>
> On Tue, Apr 12, 2011 at 6:23 AM, Tom Christie wrote:
>
>
>
> > I've been working on this with some folks:
>
> >http://django-rest-framework.org
>
> > Released 0.1 a few weeks ago, and it's coming along *really* nicely. It's
> > under v active development ATM. The auto-generated API browser is
> > particularly cool. Really would advise anyone taking a look at building web
> > APIs in python to take a look at it.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Brian Bouterse
> ITng Services

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Creating REST APIs in Django...advice

2011-04-12 Thread Brian Bouterse
I've been reading through the documentation for piston and
django-rest-framework.org and they both look like great projects.  Could
anyone with experience working with either of these applications (or their
authors themselves) provide some compare and contrasting of the
features/usability/etc.

Also, as a general REST-ism, the HTML
formtag doesn't
allow for HTTP methods besides GET and POST.  As such we
typically write a full REST API (GET, PUT, POST, DELETE), and then end up
doing the following to "make it work" for HTML/browser settings.

CREATE - POST to /resource/
READ - GET to /resource/
UPDATE - POST to /resource/
DELETE - POST to /resource/delete

The really non-restful part of the "make it work for browsers" hack is
adding the verb delete into the URL.  I couldn't think of a better way.
 This is a common pattern I end up implementing a lot, and it would be cool
if a rest framework let me accomplish this in an easier way.

Brian

On Tue, Apr 12, 2011 at 6:23 AM, Tom Christie wrote:

> I've been working on this with some folks:
>
> http://django-rest-framework.org
>
> Released 0.1 a few weeks ago, and it's coming along *really* nicely. It's
> under v active development ATM. The auto-generated API browser is
> particularly cool. Really would advise anyone taking a look at building web
> APIs in python to take a look at it.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Creating REST APIs in Django...advice

2011-04-12 Thread Tom Christie
I've been working on this with some folks:

http://django-rest-framework.org

Released 0.1 a few weeks ago, and it's coming along *really* nicely. It's under 
v active development ATM. The auto-generated API browser is particularly cool. 
Really would advise anyone taking a look at building web APIs in python to take 
a look at it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Creating REST APIs in Django...advice

2011-04-12 Thread Massimiliano della Rovere
https://bitbucket.org/jespern/django-piston/wiki/Home

skype: masdero, icq: 473891447, yim: mas_dero, msn: mas_d...@hotmail.com

Mi scriva in italiano; Write me in English; Skribu al mi Esperante!


On Tue, Apr 12, 2011 at 10:07, Mazery Smith  wrote:
> Hello,
> So can anyone here recommend some REST packages/tools you use with
> Django and have a good experience with?
>
> I'm interested to know b/c it seems like most of the popular RESTful
> Django projects really stopped being very active around mid-2008.
>
> I'm wondering if that's because most people just build their own.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Creating REST APIs in Django...advice

2011-04-12 Thread Mazery Smith
Hello,
So can anyone here recommend some REST packages/tools you use with
Django and have a good experience with?

I'm interested to know b/c it seems like most of the popular RESTful
Django projects really stopped being very active around mid-2008.

I'm wondering if that's because most people just build their own.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.