Take the 2-minute tour ×

Any pointers, advice on implementing a REST API on App Engine with Python? Using webapp for the application itself.

What I currently know is that I can:

  • hack up my own webapp handlers for handling REST-like URIs, but this seems to lose its elegance for larger amounts of resources. I mean, it's simple when it comes to temperature/atlanta, but not so much* for even a rather simple /users/alice/address/work (though do keep in mind that I'm not saying this after having implemented that, just after spending some time trying to design an appropriate handler, so my perception may be off).

  • use the REST functionality provided by one of the bigger Python web frameworks out there. I have some unexplainable sympathy towards web2py, but, since it's not used for the project, bundling it with the application just to provide some REST functionality seems.. overkill?

(Huh, looks like I don't like any of these approaches. Tough.)

So here's me asking: what advice, preferably based on experience, would you have for me here? What are my options, is my view of them correct, did I miss something?

Thanks in advance.

share|improve this question
If you have to stick with webapp you can use Appengine Rest Server. Django Rest Interface is a more powerful solution if you can use another framework. –  Paolo Moretti Aug 5 '11 at 10:27
@Paolo I was going to suggest Appengine Rest Server too, but after reading the documentation I have not found any pointers on complex url pattern like the one suggested by the OP. –  systempuntoout Aug 5 '11 at 19:25
@systempuntoout Your are right, that's why I've suggested Django Rest Interface too, because you can define your own URL patterns. –  Paolo Moretti Aug 5 '11 at 20:47

2 Answers 2

up vote 9 down vote accepted

I had a similar issue. Wanting to quickly get my DataStore exposed via REST to WebApps.

Found: AppEngine REST Server.

I have only used it lightly so far, but it certainly appears to be very useful with a small amount of work. And it does use webapp as you suggested.

share|improve this answer
Just a note: it does not support 'ndb' data model yet code.google.com/p/appengine-rest-server/issues/detail?id=54 –  Anthony Kong Sep 24 at 7:04

ProtoRPC is bundled with the SDK, and it is robust and actively developed (however experimental). Although I think the source code itself is a little convoluted, the feature-set is pretty complete and it was made by someone with experience in creating this kind of library. It supports transmiting using JSON, ProtocolBuffer and URL-encoded formats.

Also, you can create APIs that work on the server side and client side -- it defines a 'message' protocol with implementations in Python and JavaScript. I used other "RESTful" Python libraries, but no other provided this consistency out of the box.

Here is the project page and here is the mailing list.

Edit: maybe their documentation is lacking some keywords, but just to be clear: one or the purposes of ProtoRPC is to provide a solid foundation to create REST services.

share|improve this answer
What does ProtoRPC have in common with a Rest API? –  systempuntoout Aug 5 '11 at 10:16
@systempuntoout: Everything. :) ProtoRPC can be used to create REST services. –  moraes Aug 5 '11 at 10:22
Can ProtoRPC take different actions based on the HTTP method used? –  maligree Aug 5 '11 at 11:28
@moraes, would you be kind enough to either show or point to me to some example code of that being done? I've read most of the introduction article in the App Engine docs and so far I haven't seen anything like that happen. –  maligree Aug 5 '11 at 14:31
@maligree I think it is not trivial. I regret suggesting ProtoRPC as it is not primarily made for this, as systempuntoout pointed out. It can be, but you must be familiar with its internals. Sorry for the noise. –  moraes Aug 5 '11 at 16:14

Your Answer


