|Version 21 (modified by 13 years ago) ( diff ),|
This page hosts detailed specifications for Blueprint for the RESTful API.
Web2Py generates URLs in this format:
These are generally fairly RESTful anyway, e.g.:
/sahana/gis/add_feature /sahana/gis/list_features /sahana/gis/features # List_add /sahana/gis/display_feature/1 /sahana/gis/update_feature/1
We can easily change to URLs like these (see BluePrintRESTImplementation):
/sahana/gis/feature # Acts as 'list' /sahana/gis/feature/id # Acts as 'display' /sahana/gis/feature/create /sahana/gis/feature/list /sahana/gis/feature/list_add /sahana/gis/feature/display/id /sahana/gis/feature/update/id /sahana/gis/feature/delete/id
However, is there much benefit in this?
There are downsides:
- We need to be authenticated for all actions (unless we patch T2)
- Controller functions are less readable, with more levels of indent.
NB T3 requires ID to be the last argument, so don't want URLs like: /id/create
We want to extend this to export raw data in other formats, e.g. using the optional vars:
or another arg:
Web2Py already supports export as JSON, CSV & RTF.
- New SQLROW to JSON function: http://groups.google.com/group/web2py/browse_thread/thread/dfb65087574c24f1
- For XML Parser discussions, look at BluePrintGISImportExport
It would be best for us to add support to the framework to make it easy for module writers to have this functionality within their controllers.
NB Web2Py currently doesn't support HTTP PUT/DELETE/UPDATE (only GET).
This means a little work in clients but isn't too bad if we maintain consistency: no variations between add/create, view/display, edit/update, etc
Discussion of changes to Web2Py to make it more RESTful:
Allows multiple client UIs
REST instead of SOAP
Less bloat, more GIS-friendly.
- Second Generation Web Services: http://www.onlamp.com/pub/a/php/2003/10/30/amazon_rest.html
- Implementing REST Web Services: Best Practices and Guidelines: http://www.xml.com/pub/a/2004/08/11/rest.html
- Common REST Mistakes: http://www.prescod.net/rest/mistakes/
- How to Create a REST Protocol: http://www.xml.com/pub/a/2004/12/01/restful-web.html
Python REST Servers
- FeatureServer: http://featureserver.org/
- WebProcessingServer: http://code.google.com/p/webprocessingserver/
- Tarawa framework: http://www.mnot.net/tarawa/tutorial.html
- Rest in Python framework: http://lukearno.com/projects/rip/
Python REST Clients
- Python client using urllib2: http://mail.python.org/pipermail/baypiggies/2008-January/002853.html
- REST client lib: http://code.google.com/p/py-restlib/
- GAE: http://code.google.com/p/python-rest-client/
- wxWidgets desktop app: http://restclient.org/
- REST framework for Zope: http://pypi.python.org/pypi/z3c.rest
- Ext JSONStore
- Offline: http://www.dotnetkicks.com/opensource/SonicCast_7_SubSonic_REST_and_Jquery_AJAX