${ util.include('header', [title: 'Index', imports: [ [ type:'css', content: '* {font-family: \'Droid Sans\', sans-serif; } \ndiv.content { font-size: 0.8em; }\ndiv.code { background-color:whitesmoke; padding: 3px; margin:3px 5px; }' ] ]]) }
This is a list of currently available and installed features of REST API.
To see details of each request, click on this item and it will expand showing description of usage.
In this examples we present example request content and response content in form of XML as this is default format used for content by Tigase XMPP Server and it's REST API. However by different format may be used. Currently Tigase XMPP Server supports JSON or XML:
To use JSON format you need to pass application/json as type url paramter of HTTP request or by passing same value as value of Content-Type HTTP request header.
To ensure use of XML format you need to pass application/xml as type url paramter of HTTP request or by passing same value as value of Content-Type HTTP request header.
Note: If no type attribute is passed and Content-Type is set to text/html then response may not be sent in form of JSON or XML but in user readable form of HTML web page.
<% def colors = [ 'GET' : '#0f6ab4', 'POST' : '#547f00', 'PUT' : '#c5862b', 'DELETE' : '#a41e22' ]; def servlets = []; servlets.addAll(result.service.module.restServlets); servlets = servlets.findAll { it.handlers.values().find { !it.isEmpty() } } servlets.sort { it.getServletContext()?.getContextPath() } servlets.each { def prefix = request.getContextPath() + it.getInitParameter("mapping").replace("/*",""); def handlers = []; it.handlers.values().each { v -> handlers.addAll(v); } handlers = handlers.unique(); handlers.sort { it.regexDescription ?: it.regex } handlers.each { handler -> ["GET","PUT","POST","DELETE"].each { method -> if (!handler."exec${method.toLowerCase().capitalize()}") return; def color = colors[method]; def id = java.util.UUID.randomUUID().toString(); %>
${method}
${prefix}${(handler.description?.regex) ?: handler.regex}
${handler.description?."$method"?.info}
${result.fillTemplate(handler.description?."$method"?.description)}
<% } %> <% } %> <% } %>
${ util.include('footer') }