1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="layout.html" />
<xi:include href="macros.html" />
<head>
<title>XML-RPC</title>
</head>
<body>
<div id="content" class="wiki">
<h1>Remote Procedure Call (RPC) Interface</h1>
<dl>
<dt>API Status:</dt>
<dd>XML-RPC is <strong>available</strong></dd>
<dd>JSON-RPC is <strong>
${xmlrpc.json and 'available' or 'not available'}</strong></dd>
</dl>
<h2>RPC exported functions</h2>
<div id="searchable">
<dl py:for="key in sorted(xmlrpc.functions)" py:with="namespace = xmlrpc.functions[key]">
<dt>
<h3 id="${'xmlrpc.' + to_unicode(namespace.namespace)}">
${namespace.namespace} - ${namespace.description}
</h3>
</dt>
<dd>
<table class="listing tickets">
<thead>
<tr>
<th style="width:40%">Function</th>
<th style="width:45%">Description</th>
<th style="width:15%">Permission required</th>
</tr>
</thead>
<tbody py:for="idx, function in enumerate(namespace.methods)">
<tr class="${'color3-' + (idx % 2 == 0 and 'even' or 'odd')}">
<td style="padding-left:4em;text-indent:-4em">${function[0]}</td>
<td>${function[1]}</td>
<td>${function[2] or "By resource"}</td>
</tr>
</tbody>
</table>
</dd>
</dl>
</div>
<h2>Calling Methods</h2>
<p>XML and JSON libraries for remote procedure calls and parsing exists
for all major languages and platforms - use a tested, standard library
for consistent results.</p>
<p>The following are examples for illustration only, and shows raw
access to RPC using <tt>curl</tt> (with Content-Type and Body for POST request):</p>
<div class="help">
<h4>XML-RPC example</h4>
<pre>
user: ~ > cat body.xml
<?xml version="1.0"?>
<methodCall>
<methodName>wiki.getPage</methodName>
<params>
<param><string>WikiStart</string></param>
</params>
</methodCall>
user: ~ > curl -H "Content-Type: application/xml" --data @body.xml ${req.abs_href.xmlrpc()}
<?xml version='1.0'?>
<methodResponse>
<params>
<param>
<value><string>= Welcome to....
</pre>
<ul>
<li>Use <tt>${req.abs_href.login('xmlrpc')}</tt> with basic
authentication for user context.</li>
</ul>
</div>
<div>
<h4>JSON-RPC example</h4>
<pre>
user: ~ > cat body.json
{"params": ["WikiStart"], "method": "wiki.getPage", "id": 123}
user: ~ > curl -H "Content-Type: application/json" --data @body.json ${req.abs_href.jsonrpc()}
{"id": 123, "error": null, "result": "= Welcome to....
</pre>
<ul>
<li>JSON-RPC has no formalized type system, so a class-hint system is used
for input and output of non-standard types:
<ul>
<li><tt>{"__jsonclass__": ["datetime", "YYYY-MM-DDTHH:MM:SS"]}</tt>
= DateTime (UTC)</li>
<li><tt>{"__jsonclass__": ["binary", "<base64-encoded>"]}</tt>
= Binary</li>
</ul>
</li>
<li><tt>"id"</tt> is optional, and any marker value received with a
request is returned with the response.</li>
<li>Use <tt>${req.abs_href.login('jsonrpc')}</tt> with basic
authentication for user context.</li>
</ul>
</div>
<script type="text/javascript">
addHeadingLinks(document.getElementById("searchable"));
</script>
</div>
</body>
</html>
|