Revision [20021]

This is an old revision of RESTHandlerInfo made by DomBonj on 2008-06-08 08:02:26.

 

REST Handler Documentation

Not Included in official Wikka version

See also:
Development: RESTHandler
This is the documentation page for the REST handler.
 

Documentation


Short description
Turn your wiki into a web service provider, by extracting selected bits of a page and serving them as XML data.

Parameters
Parameters are passed in the URL suffix, formatted as rest/tag/attribute/value/rank, where:

nametyperequired?defaultdescription
tagstringoptionalThe name of an XHTML tag (e.g. 'p', 'div', etc.)
attributestringoptionalThe name of an XHTML attribute (e.g. 'class', 'id', etc.)
valuestringoptionalThe value of the XHTML attribute. If present, attribute has to be present too (see examples below)
rankintegeroptionalThe sequence number of the targeted tag in the page

All parameters can be omitted but the '/' separator has to be present it there are subsequent parameters (see examples below.)

Long description
All wikkawiki pages are structured documents, the structure being provided by XHTML tags. With the REST handler, specified chunks of a page can be extracted and provided as XML data. This helps turning any wiki into a web service provider and enables other applications or data consumers to access and process portions of a page.
This handler is a partial implementation (offering only a read-only mode, i.e. only the 'GET' method is supported) of the REST style of implementing web services.
All wiki page elements (paragraphs, images, hyperlinks, etc.) are called "resources" in REST parlance. The resource(s) to be selected by the handler are specified by the parameters passed in the URL (see previous paragraph and the examples below.) Note that only resources located inside the page content itself, but not the header and footer, are accessible (in technical terms, inside the '<div class="page">')
The output of this handler is a text file containing valid XHMTL, with an XML preamble and the HTTP 'Content-Type' set to text/xml. It is thus valid XML data and can be processed by any XML parser. Note that the output of this handler can be viewed inside a web browser (e.g. for debugging purposes), but that most of the time it is expected to be consumed by a program, not viewed directly.

Usage
http://www.wikkawiki.org/wikka.php?wakka=HomePage/rest/div///2


Examples

tagattributevaluerankURL suffixComments
p/pSelects all the paragraphs (<p> tag) in the page
pclass/p/classSelects all the paragraphs in the page having a 'class' attribute, whatever its value. This will select <p class='title'> but not <p id='examples'>
pclasscode/p/class/codeSelects all the paragraphs in the page having a 'class' attribute equal to 'code'
pclasscode3/p/class/code/3Selects the third paragraph in the page which has a 'class' attribute equal to 'code'
p3/p///3Selects the third paragraph in the page, whatever its attributes
3///3Selects the third tag in the page, whatever its type and attributes
pcode/p//codeNot allowed
code///codeNot allowed


To-do, bugs and limitations


Author
DomBonj


CategoryDocumentation
There are 9 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki