How to implement a RESTful API on an App Engine server using webapp (authentication + Facebook)?

so my idea is pretty simple. But I donโ€™t know where to start.

create a simple RESTful API on my application engine server using a simple webapp infrastructure.

there will be two types of customers:
1. Regular PC users get access to the facebook application, and this will directly host API calls on my application engine server. (Note that the facebook application is hosted on the same application engine server)

  1. Iphone users access my application engine server by going to Facebook. The user can then make API calls.

So, as I tested the App3 project at http://code.google.com/p/app3/ , then there really was no authentication.

Any suggestions / ideas?

I have a general idea of โ€‹โ€‹how a thread works.

Assumption: I have a data store configured with user data.

For regular PC users accessing my FB application: -> authenticate in FB โ†’ I save their userid + facebook_session_key with gmemsess โ†’ I use both authentication data with user data in my data store โ†’ this user can now CRUD freely on my server .

For iphone users, this is the same stream. But with Facebook Connect.

CRUD should look something like this: if the user wants to check his statistics, the API call will look something like this: / Rest / getstats

Does anyone really do something like this? I will be grateful to everyone for your understanding. A simple, free solution would be awesome!

+4
source share
1 answer

Well, this may not be what you were looking for, but here is my attempt:

To make simple REST on the application engine, you can try the excellent Jim Fulton library, bobo (here is a link to the REST section of the documentation ). Bobo is a proven, simple package containing only one fily, bobo.py, so it is ideal for the minimalistic needs of the application. You can just put it on top of webapp.

Note that the decorators shown in the documentation must be converted to python2.5-style to work, so

 @bobo.resource('/rest/getstats', 'GET') def get_stats(self, request): "Get user stats" 

will become

 def get_stats(self, request): "Get user stats" get_stats = bobo.resource('/rest/getstats', 'GET')(get_stats) 

etc. This should be a simple REST approach.

As for authentication, you can double-check repoze.who in the WSGI pipeline. There are some very simple repoze.who plugins for the facebook API out there in the wild (unfortunately not one of them in pypi), I wrote a very simple self for a simple facebook application some time ago. You can check it out here , as well as a brief wiki and some dependency graphs that can help your application have easy and efficient memory access. (Pay attention to the dependency graphs: some Zope libraries have been simplified since then, for authentication on Facebook you only need zope.interface.)

Perhaps I really have not given you anything specific (or useful), but these are just a few links that you can take a look at, they can come in handy.

+3
source

All Articles