=====REST Handler Documentation=====
//Not Included in official Wikka version//
>>==See also:==
Development: [[RESTHandler]]>>This is the documentation page for the REST handler.::c::
===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:
""
')
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%%
==Error handling==
Any error will be reported both in the HTTP 'Status-Code' header and in the body of the XML reply, formatted as in this example (the message string can be localized):
%%(xml)
IllegalParameters
Illegal parameter(s) value
GET */*/*/8
%%
===Examples===
""
tag | attribute | value | rank | URL suffix | Comments |
p | | | | /p | Selects all the paragraphs (<p> tag) in the page |
p | class | | | /p/class | Selects
all the paragraphs in the page having a 'class' attribute, whatever its value. This will select <p class='title'> but not <p id='examples'> |
p | class | code | | /p/class/code | Selects
all the paragraphs in the page having a 'class' attribute equal to 'code' |
p | class | code | 3 | /p/class/code/3 | Selects
the third paragraph in the page which has a 'class' attribute equal to 'code' |
p | * | * | 3 | /p/*/*/3 | Selects the third paragraph in the page, whatever its attributes |
p | id | * | 3 | /p/id/*/3 | Selects the third paragraph in the page having a 'id' attribute, whatever its value |
* | * | * | 3 | /*/*/*/3 | Not
allowed |
p | * | code | | /p/*/code | Not
allowed |
* | * | code | | /*/*/code | Not
allowed |
""
As an example, the following URL:
%%http://www.wikkawiki.org/wikka.php?wakka=HomePage/rest/div/*/*/2%%
yields the following result:
%%(xml)
Welcome to Wikka Wiki
%%
===To-do, bugs and limitations===
~- **Main limitation:** this handler will only work on a web server supporting PHP5.
~- At this time, character encoding is UTF-8. This may be viewed by some as a limitation.
==Author==
DomBonj
----
CategoryDocumentation