-
ATREST: RESTful Web Services for AT Content Types
last modified August 1, 2007 by siebo
We created a new product in the collective, ATRest.
This product adds a new Zope 3 view that gives every piece of AT content (folders and non-folders) a RESTful web service interface.
It currently provides a read web service for all AT fields on any ATBaseObject. Version 1.0 of the Marshall product provides this functionality.
For ATBaseFolder derived types it provides the title and some basic metadata about the contained objects. ** Note: this bit has been updated to use a catalog query for improved performance.
In the future we want to provide create, delete, and edit web services.
This product should work with Plone 2.5 and 3.0. It requires that you replace the Marshall product that comes with Plone with the 1.0 version (either get from trunk or tag 1.0.0-b1).
We intend to support Plone 2.1. This may require writing a marker interface for IBaseObject and IBaseFolder. When siebo looked at a 2.1 bundle, those interfaces appeared to be there... but the product crashed the site by somehow taking out the Five stack. Maybe we just need to tell 2.1 users they need a certain version of Five...
To install, put the Marshall 1.0 and ATRest products into your Products directories. Restart Zope and use Plone site setup to install Marshall. ATRest does not need to be installed. The Marshall product _does_ have to be installed from the quickinstaller.
To use the product, put @@atxml at the end of the URL of any AT that inherits from BaseObject. This will return an XML representation of the object. Similarly, for an AT type that is derived from BaseFolder object put @@xml-listing at the end of the URL.
If you want to provide a customized XML representation for a particular AT content type, just create a .zcml file and .py file similar to ATRest's configure.zcml and browser.py in your product directory, and specifying your product's content type.
Look at the code in Marshall/marshaller.py to see how the call to marshall can be customized to only display certain fields/namespaces/security settings.
Soon we'd like to implement something similar to wrap the result set of SmartFolders...