Version 8 (modified by 16 years ago) ( diff ) | ,
---|
RESTful API
This page hosts detailed specifications for Blueprint for the RESTful API.
Basic approach for the S3 architecture is to have a Web Services backend & a Javascript client front end. RESTful APIs make this easier.
Web2Py generates URLs in this format:
/application/ccontroller/function/arg1/arg2?var1=x,var2=y
These are generally fairly RESTful anyway, e.g.:
/sahana/gis/add_feature /sahana/gis/list_features /sahana/gis/display_feature/1 /sahana/gis/update_feature/1
Is there much benefit in chaning to URLs like:
/sahana/gis/feature/create /sahana/gis/feature/list /sahana/gis/feature/list_add /sahana/gis/feature/display/x /sahana/gis/feature/update/x
We want to be able extending this for exporting raw data in other formats, e.g. using the optional vars:
/sahana/gis/feature/display/x?format=[json|xml|csv]
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 Import/Export
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.
Discussion of changes to Web2Py to make it more RESTful:
- http://www.wellbehavedsystems.co.uk/web2py/examples/rest.html
- http://www.wellbehavedsystems.co.uk/web2py/examples/rest_alt1.html
NB Web2Py currently doesn't support HTTP PUT/DELETE/UPDATE (only GET).
Web Services
Allows multiple client UIs
- http://talks.php.net/show/webservices/
- http://webservices.xml.com/pub/a/ws/2004/03/24/phpws.html
- http://wiki.sahana.lk/doku.php?id=dev:web_services
REST instead of SOAP
Less bloat, more GIS-friendly.
- http://en.wikipedia.org/wiki/Representational_State_Transfer
- 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