DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:xmlrpc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devel:xmlrpc [2017-06-14 14:44] – [Table] 80.156.250.234devel:xmlrpc [2024-01-31 23:57] (current) – [Adding methods to the XML-RPC API] Klap-in
Line 1: Line 1:
 ====== XML-RPC ====== ====== XML-RPC ======
-[[:experimental]] 
  
-DokuWiki has an experimental [[wp>XML-RPC]] API which can be used to access/interact with your wiki from other applications. The API implements the [[http://www.ecyrd.com/JSPWiki/wiki/WikiRPCInterface2|Wiki RPC Interface 2.0 Specifications]] in the ''wiki.*'' namespace and adds additional DokuWiki specific calls in the ''dokuwiki.*'' namespace. See [[custom_webservices|web services]] for some general notes about DokuWikis possibilities.+XML-RPC is one of the available protocols to access DokuWiki's [[Remote API]]. 
 + 
 + 
 +The API implements the [[http://www.jspwiki.org/wiki/WikiRPCInterface2|Wiki RPC Interface 2.0 Specifications]] ([[https://web.archive.org/web/20130526043929/http://www.jspwiki.org/wiki/WikiRPCInterface2|web.archive.org]]) in the ''wiki.*'' namespace and adds additional DokuWiki specific calls in the ''dokuwiki.*'' namespace.  
 + 
 +Plugins can add their own calls to the API using [[devel:remote_plugins|Remote Plugin components]]. 
 + 
 +Note: there is also a [[jsonrpc|JSON-RPC]] API which provides the same functionality but is based on JSON rather XML. 
  
-Questions and suggestions to extend and improve the API should be directed to the [[:mailinglist]]. 
 ===== Get It Working ===== ===== Get It Working =====
-  - You need at least the 2008-03-31 release of DokuWiki. + 
-  - Enable the XML-RPC interface in the "Authentication Settings" section +  - Set the [[config:remote]] option to enable XML-RPC in the Configuration Settings "Authentication" section 
-  - Set the [[config:remoteuser]] option+  - Set the [[config:remoteuser]] option with a mix of comma separated "usernames,groups" 
   - For security reasons it's safer to allow access to the XML-RPC over HTTPS only. DokuWiki's ''.htaccess.dist'' contains some rewrite rules to do that.   - For security reasons it's safer to allow access to the XML-RPC over HTTPS only. DokuWiki's ''.htaccess.dist'' contains some rewrite rules to do that.
 +  - You might need to install an XML package like ''php-xml'' (on debian)
 +
  
 ===== Accessing The XML-RPC Interface ===== ===== Accessing The XML-RPC Interface =====
Line 17: Line 25:
 or or
   https://<your wiki/domain/ip>/lib/exe/xmlrpc.php   https://<your wiki/domain/ip>/lib/exe/xmlrpc.php
 +
 +Here are some [[devel:xmlrpc:clients|Samples of Clients using the XML-RPC Api]] to test with
 +
  
 ===== Sample XML Requests ===== ===== Sample XML Requests =====
 +
 +You should use an XML-RPC library instead of hand-crafting your requests.
 +
 Here is an example of how to post to the API: Here is an example of how to post to the API:
 +
 +
 <code xml> <code xml>
 POST /RPC2 HTTP/1.0 POST /RPC2 HTTP/1.0
Line 28: Line 44:
  
 <?xml version="1.0"?> <?xml version="1.0"?>
-  <methodCall>+<methodCall>
     <methodName>examples.getStateName</methodName>     <methodName>examples.getStateName</methodName>
     <params>     <params>
-      <param>  +        <param>  
-        <value> +            <value> 
-          <i4>41</i4> +                <i4>41</i4> 
-        </value> +            </value> 
-      </param> +        </param> 
     </params>      </params> 
-  </methodCall> +</methodCall> 
 </code> </code>
  
 <code xml> <code xml>
-  <?xml version="1.0"?> +<?xml version="1.0"?> 
-    <methodCall> +<methodCall> 
-      <methodName>dokuwiki.getVersion</methodName> +    <methodName>dokuwiki.getVersion</methodName> 
-    </methodCall>+</methodCall>
 </code> </code>
  
Line 50: Line 66:
  
 <code xml> <code xml>
-  <?xml version="1.0"?>+<?xml version="1.0"?>
 <methodCall> <methodCall>
- <methodName>wiki.putPage</methodName> +    <methodName>wiki.putPage</methodName> 
- <params> +    <params> 
- <param>  +        <param>  
- <value> +            <value> 
- <string>myputpage   +                <string>myputpage   
- </string> +                </string> 
- </value> +            </value> 
- </param>  +        </param>  
- <param>  +        <param>  
- <value> +            <value> 
- <string>======  Devices List ====== +                <string>This is my page content</string> 
-Report Created on 2017-05-25 16:23:37 +            </value> 
-===== Servers ===== +        </param> 
-^ID ^Name ^Description ^IP ^Type ^OS ^Last Scan ^ +        <param>  
-|18 |[[:inventory:devices:Computer:adminserver ID-18|adminserver]] |AT/AT COMPATIBLE |192.168.1.1 |Server |Microsoft Windows 2000 Server |2017-05-25 16:09:10 | +            <value> 
- +                <struct> 
- </string> +                    <member> 
- </value> +                        <name>sum</name> 
- </param> +                        <value><string>Spiceworks</string></value> 
- <param>  +                    </member> 
- <value> +                    <member> 
- <struct> +                        <name>minor</name> 
- <member> +                        <value><boolean>True</boolean></value> 
- <name>sum</name> +                    </member> 
- <value><string>Spiceworks</string></value> +                </struct> 
- </member> +            </value> 
- <member> +        </param>  
- <name>minor</name> +    </params> 
- <value><boolean>True</boolean></value> +
- </member> +
- </struct> +
- </value> +
- </param>  +
- </params> +
 </methodCall> </methodCall>
 </code> </code>
Line 114: Line 124:
 ^ Parameters  | - | ^ Parameters  | - |
 ^ Data        | (int) timestamp | ^ Data        | (int) timestamp |
-^ Description | Returns the current time at the remote wiki server as Unix timestamp |+^ Description | Returns the current time at the remote wiki server as Unix timestamp|
 ^ Since       | 2009-03-06 (1) | ^ Since       | 2009-03-06 (1) |
  
Line 121: Line 131:
 ^ Parameters  | - | ^ Parameters  | - |
 ^ Data        | (int) version number | ^ Data        | (int) version number |
-^ Description | Returns the XML RPC interface version of the remote Wiki. This is DokuWiki implementation specific and independent of the supported standard API version returned by wiki.getRPCVersionSupported |+^ Description | Returns the XML RPC interface version of the remote Wiki. This is DokuWiki implementation specific and independent of the supported standard API version returned by wiki.getRPCVersionSupported|
 ^ Since       | 2009-03-06 (1) | ^ Since       | 2009-03-06 (1) |
  
Line 135: Line 145:
 ^ Parameters  | (string) a query string as described on [[:search]] | ^ Parameters  | (string) a query string as described on [[:search]] |
 ^ Data        | (array) associative array with matching pages similar to what is returned by ''dokuwiki.getPagelist'', snippets are provided for the first 15 results | ^ Data        | (array) associative array with matching pages similar to what is returned by ''dokuwiki.getPagelist'', snippets are provided for the first 15 results |
-^ Description | Performs a fulltext search |+^ Description | Performs a fulltext search|
 ^ Since       | 2010-02-28 (3) | ^ Since       | 2010-02-28 (3) |
  
Line 143: Line 153:
 ^ Parameters  | - | ^ Parameters  | - |
 ^ Data        | (string) the title of the wiki | ^ Data        | (string) the title of the wiki |
-^ Description | Returns the title of the wiki |+^ Description | Returns the title of the wiki|
 ^ Since       | 2010-04-18 (4) | ^ Since       | 2010-04-18 (4) |
  
Line 158: Line 168:
  
 ^ Name        | ''dokuwiki.setLocks'' | ^ Name        | ''dokuwiki.setLocks'' |
-^ Parameters  | (array) list of two lists of page ids <code php>array('lock'=>array(...), 'unlock'=>array(...))</code>+^ Parameters  | (array) list of two lists of page ids <code>
-^ Data        | (array) array with 4 lists of pageids <code php>array('locked'=>array(...), 'lockfail'=>array(...), 'unlocked'=>array(...), 'unlockfail'=>array(...))</code>+    'lock' => [...] 
-^ Description | Allows you to lock or unlock a whole bunch of pages at once. Useful when you are about to do an operation over multiple pages |+    'unlock' => [...
 +]</code>
 +^ Data        | (array) array with 4 lists of pageids <code>
 +    'locked' => [...] 
 +    'lockfail' => [...] 
 +    'unlocked' => [...] 
 +    'unlockfail' => [...
 +]</code>
 +^ Description | Allows you to lock or unlock a whole bunch of pages at once. Useful when you are about to do an operation over multiple pages|
 ^ Since       | 2009-03-06 (1) | ^ Since       | 2009-03-06 (1) |
 +
 +==== dokuwiki.createUser ====
 +
 +^ Name        | ''dokuwiki.createUser'' |
 +^ Parameters  | (array) parameters, where ''parameters'' can contain:  <code>$params =  [
 +                'user' => 'username',
 +                'password' => 'password1',
 +                'name' => 'User Name',
 +                'mail' => 'user@example.com',
 +                'groups' => [
 +                    'user',
 +                    'test'
 +                ],
 +                'notify' => false
 +            ]</code> |
 +^ Data        | (bool) true if the user is created |
 +^ Description | Create a user. Returns 400 range [[#xml-rpc_error_codes|error codes]] if input is not accepted.|
 +^ Since       | 2022-06-24 |
 +
 +
 +==== dokuwiki.deleteUsers ====
 +
 +^ Name        | ''dokuwiki.deleteUsers'' |
 +^ Parameters  | (array) list of usernames to delete |
 +^ Data        | (bool) true if the users were deleted |
 +^ Description | Allows you to delete one or more users. Useful to implement GDPR right to be forgotten tools. |
 +^ Since       | 2018-05-24 |
  
 ==== wiki.getRPCVersionSupported ==== ==== wiki.getRPCVersionSupported ====
Line 190: Line 235:
 ^ Name         | ''wiki.getPageVersions''                                                                                                                                                                                                                                                               | ^ Name         | ''wiki.getPageVersions''                                                                                                                                                                                                                                                               |
 ^ Parameters   | (string) [[:pagename]], (int) offset                                                                                                                                                                                                                                                   | ^ Parameters   | (string) [[:pagename]], (int) offset                                                                                                                                                                                                                                                   |
-^ Data         | (array) each array item holds the following data: \\ \\ <code>$data['user'] = username $data['ip'] = ip address $data['type'] = type of change $data['sum'] = summary $data['modified'] =  modification date as IXR_Date Object  $data['version'] = page version as timestamp </code> +^ Data         | (array) each array item holds the following data: \\ \\ <code>$data['user'] = username 
-^ Description  | Returns the available versions of a Wiki page. The number of pages in the result is controlled via the [[:config:recent]] configuration setting. The offset can be used to list earlier versions in the history..                                                                      |+$data['ip'] = ip address 
 +$data['type'] = type of change 
 +$data['sum'] = summary 
 +$data['modified'] =  modification date as IXR_Date Object 
 +$data['version'] = page version as timestamp</code> 
 +^ Description  | Returns the available versions of a Wiki page. The number of pages in the result is controlled via the [[:config:recent]] configuration setting. The offset can be used to list earlier versions in the history.  |
  
 ==== wiki.getPageInfo ==== ==== wiki.getPageInfo ====
Line 291: Line 341:
 $data['perms'] = permissions of file $data['perms'] = permissions of file
 </code>| </code>|
-^ Description | Returns a list of media files in a given namespace. The options are passed directly to [[xref>search_media()]]|+^ Description | Returns a list of media files in a given namespace. The options are passed directly to [[xref>search_media()]]|
  
 ==== wiki.getAttachment ==== ==== wiki.getAttachment ====
Line 297: Line 347:
 ^ Parameters  | (String) id | ^ Parameters  | (String) id |
 ^ Data        | (string) the data of the file, encoded in base64 | ^ Data        | (string) the data of the file, encoded in base64 |
-^ Description | Returns the binary data of a media file |+^ Description | Returns the binary data of a media file|
  
 ==== wiki.getAttachmentInfo ==== ==== wiki.getAttachmentInfo ====
Line 304: Line 354:
 ^ Data        | (array) an array containing the following information about the file: \\ \\ <code>$data['size'] = size in bytes ^ Data        | (array) an array containing the following information about the file: \\ \\ <code>$data['size'] = size in bytes
 $data['lastModified'] = modification date as XML-RPC Date object</code> | $data['lastModified'] = modification date as XML-RPC Date object</code> |
-^ Description | Returns information about a media file |+^ Description | Returns information about a media file|
  
 ==== wiki.putAttachment ==== ==== wiki.putAttachment ====
 ^ Name        | ''wiki.putAttachment'' | ^ Name        | ''wiki.putAttachment'' |
-^ Parameters  | (String) id, (base64) data, (array) params |+^ Parameters  | (String) id, (base64) data, (array) params\\ Available parameters are: <code>$params['ow'] = true if file is to overwrite an already 
 +existing media object of the given id.</code> |
 ^ Data        | | ^ Data        | |
-^ Description | Uploads a file as a given media id. Available parameters are: \\ \\ <code>$params['ow'] = true if file is to overwrite an already existing media object of the given id</code> |+^ Description | Uploads a file as a given media id. |
  
 ==== wiki.deleteAttachment ==== ==== wiki.deleteAttachment ====
Line 317: Line 368:
 ^ Data        | | ^ Data        | |
 ^ Description | Deletes a file. Fails if the file is still referenced from any page in the wiki. | ^ Description | Deletes a file. Fails if the file is still referenced from any page in the wiki. |
 +
 +==== plugin.acl.listAcls ====
 +^ Name        | ''plugin.acl.listAcls'' |
 +^ Parameters  | - |
 +^ Data        | (array) of ACLs {scope, user, permission}'|
 +^ Description | Get the list of all ACLs. |
  
 ==== plugin.acl.addAcl ==== ==== plugin.acl.addAcl ====
Line 322: Line 379:
 ^ Parameters  | (String) scope, (String) username, (int) permission | ^ Parameters  | (String) scope, (String) username, (int) permission |
 ^ Data        | (boolean) return true if the rule was correctly added| ^ Data        | (boolean) return true if the rule was correctly added|
-^ Description | Add an ACL rule. Use ''@groupname'' instead of ''user'' to add an ACL rule for a group |+^ Description | Add an ACL rule. Use ''@groupname'' instead of ''user'' to add an ACL rule for a group|
  
 ==== plugin.acl.delAcl ==== ==== plugin.acl.delAcl ====
Line 328: Line 385:
 ^ Parameters  | (String) scope, (String) username | ^ Parameters  | (String) scope, (String) username |
 ^ Data        | (boolean) return true if the rules were correctly deleted| ^ Data        | (boolean) return true if the rules were correctly deleted|
-^ Description | Delete any ACL rule matching the given scope and user. Use ''@groupname'' instead of ''user'' to delete the ACL rules for the group|+^ Description | Delete any ACL rule matching the given scope and user. Use ''@groupname'' instead of ''user'' to delete the ACL rules for the group|
  
  
 =====Adding methods to the XML-RPC API===== =====Adding methods to the XML-RPC API=====
 Use [[plugintype>64#extension__table|Remote Plugins]] to add other methods to the XML-RPC API.  Use [[plugintype>64#extension__table|Remote Plugins]] to add other methods to the XML-RPC API. 
 +
 +A summary of recent plugins which indicate Remote support:
 +
 +---- pluginquery -----
 +SELECT: name, description
 +WHERE:  (type > ? AND type < ?) and (bestcompatible LIKE ? OR bestcompatible LIKE ? OR compatible = ?)
 +VALUES: 63, 128, @DATEMOSTRECENT@, @DATESECONDMOSTRECENT@, (bundled)
 +headline: Remote plugins compatible with last two releases
 +-----
  
 To implement such a plugin please have a look at the [[remote plugins|remote plugins development documentation]]. To implement such a plugin please have a look at the [[remote plugins|remote plugins development documentation]].
Line 369: Line 435:
     * //320 -> Search result errors//     * //320 -> Search result errors//
       * 321 -> No changes in specified timeframe       * 321 -> No changes in specified timeframe
 +  * //400 -> User management errors//
 +    * 401 invalid user name given
 +    * 402 invalid user name given
 +    * 403 invalid email address given
  
 Additionally there are some server error codes that indicate some kind of server or XML-RPC failure. The codes are the following: Additionally there are some server error codes that indicate some kind of server or XML-RPC failure. The codes are the following:
Line 382: Line 452:
   * -99999 -> Unknown server error.   * -99999 -> Unknown server error.
  
-===== Sample Java Client ===== +===== Sample Clients =====
-A java client for Dokuwiki is available on [[https://github.com/gturri/dokujclient|github]]. +
- +
-Example which displays the title of the wiki and the list of its pages: +
-<code java> +
-import dw.xmlrpc.DokuJClient; +
-import dw.xmlrpc.Page; +
- +
-public class Main { +
-  public static void main(String[] args) throws Exception{ +
-    String url = "http://mywiki/lib/exe/xmlrpc.php"; +
-    String user = "myUser"; +
-    String pwd = "myPassword"; +
- +
-    DokuJClient client = new DokuJClient(url, user, pwd); +
-    System.out.println("Pages in the wiki " + client.getTitle() + " are:"); +
-    for(Page page : client.getAllPages()){ +
-      System.out.println(page.id()); +
-    } +
- +
-  } +
-+
-</code> +
- +
-===== Sample PHP Client ===== +
-This simple example will pull the version information from the given DokuWiki. +
- +
-  * You need to download and install the library [[http://phpxmlrpc.sourceforge.net/|XML-RPC for PHP]] for this example. +
-  * The URL of the DW-Server must be given **without** the procotol (<nowiki>http://</nowiki>). +
- +
-<code php> +
-<?php +
-include('lib/xmlrpc.inc');  // or whereever you have downloaded and put the XML-RPC for PHP libraries +
- +
-// create a new client instance +
-$c = new xmlrpc_client('/lib/exe/xmlrpc.php', 'adminwiki.kreisbote.de', 80); +
- +
-// enable debugging to see more infos :-) (well, not for production code) +
-$c->setDebug(1); +
- +
-// create the XML message to send +
-$m = new xmlrpcmsg('dokuwiki.getVersion'); +
- +
-// send the message and wait for response +
-$r = $c->send($m); +
-if($r == false) die('error'); +
-if(!$r->faultCode()){ +
-    // seems good. Now do whatever you want with the data +
-    $v = php_xmlrpc_decode($r->value()); +
-    echo "$v"; +
-+
-</code> +
- +
-<code php> +
-<?php +
-include('/lib/xmlrpc.inc'); +
- +
-$c = new xmlrpc_client('/lib/exe/xmlrpc.php', 'localhost', 80); +
-$c->setDebug = 1; +
- +
-$m = new xmlrpcmsg('wiki.putAttachment'); +
-$m->addParam(new xmlrpcval("file.png", "string")); +
-$m->addParam(new xmlrpcval("iVBORw0KGgoAAAANSUhEUgAAADAAAAAwC.....<base64 string here>...", "base64")); +
-$m->addParam(new xmlrpcval(array("ow" => new xmlrpcval(true, "boolean")), "struct")); +
- +
-$r = $c->send($m); +
-if($r == false) die('foo!'); +
- +
-// Output the response object +
-// var_dump($r); +
-$r = $c->send($m); +
- +
-if(!$r->faultCode()) { +
-    $v = php_xmlrpc_decode($r->value()); +
-    echo $v; +
-} else { +
-    echo $r->faultString(); +
-+
- +
-?> +
-</code> +
- +
-DokuWiki has its own XML-RPC library which could also be used. A simple client using that library looks like this: +
- +
-<code php> +
-<?php +
-require_once('inc/init.php'); +
- +
-$client = new IXR_Client('http://localhost/devel/dokuwiki/lib/exe/xmlrpc.php'); +
-$client->debug = 1; // enable for debugging +
-$client->query('dokuwiki.login','admin','pass'); +
-$ok = $client->getResponse(); +
-if($ok) { +
-   $client->query('wiki.getPage','wiki:syntax'); +
-   echo $client->getResponse(); +
-+
-</code> +
- +
-===== Sample Perl Client ===== +
- +
-[[https://metacpan.org/pod/Dokuwiki::RPC::XML::Client|Dokuwiki::RPC::XML::Client]] is simple dokuwiki client written on top of [[https://metacpan.org/pod/RPC::XML::Client|RPC::XML::Client]], it comes with a  [[https://metacpan.org/pod/distribution/Dokuwiki-RPC-XML-Client/scripts/dokuwiki-client|CLI command]] you can use from shell. +
- +
-you can also write RPC::XML::Client code directly following this simple example will pull the version information and the list of documents in the ''wiki'' namespace from the given Dokuwiki. It also lists all ''.png'' mediafiles from the same namespace and its child namespaces. +
- +
-<code perl> +
-use strict; +
-use warnings; +
-use feature 'say'; +
-use RPC::XML::Client; +
-use Data::Dumper; +
- +
-my $client = +
-  RPC::XML::Client->new('https://www.example.com/wiki/lib/exe/xmlrpc.php'); +
- +
-my $res = $client->send_request('dokuwiki.getVersion'); +
-say 'dokuwiki.getVersion = ' . $res->value; +
- +
-my $namespace = 'wiki'; +
-my $req = +
-  RPC::XML::request->new( 'dokuwiki.getPagelist', +
-    RPC::XML::string->new($namespace), +
-    RPC::XML::struct->new() ); +
-$res = $client->send_request($req); +
-say "dokuwiki.getPagelist = \n" . Dumper $res->value; +
- +
- +
-# if given and >0 'depth' is relative to the searched namespace and is a maximum. +
-# setting 'hash' to 1 will put extra load on server. +
-$res = $client->send_request( +
- RPC::XML::request->new( 'wiki.getAttachments', +
- RPC::XML::string->new('$namespace'), +
- RPC::XML::struct->new( {depth => 2, skipacl => 1, hash => 0, pattern => '/\.png$/' } ) +
-+
-); +
-say "wiki.getAttachments = \n" . Dumper $res->value; +
- +
- +
-</code> +
- +
-===== Sample Ruby Client ===== +
-This simple example will pull the version information from the given Dokuwiki. No plugin required (in the Windows default package). +
-<code ruby> +
-require "xmlrpc/client" +
-server = XMLRPC::Client.new( "localhost","/dokuwiki/lib/exe/xmlrpc.php"+
-begin +
-    puts server.call("dokuwiki.getVersion"+
-rescue XMLRPC::FaultException => e +
-    puts "Error:" +
-    puts e.faultCode +
-    puts e.faultString +
-end +
-</code> +
- +
-This example demonstrates how to upload attachments: +
- +
-<code ruby> +
-require "xmlrpc/client" +
-server = XMLRPC::Client.new( "localhost","/dokuwiki/lib/exe/xmlrpc.php"+
-begin +
-    puts server.call("wiki.putAttachment", "wiki/example.png", XMLRPC::Base64.new(IO.read("/path/to/example.png"))) +
-rescue XMLRPC::FaultException => e +
-    puts "Error:" +
-    puts e.faultCode +
-    puts e.faultString +
-end +
-</code> +
- +
-===== Sample jQuery Client ===== +
-<code javascript> +
-var xml='<?xml version="1.0"?><methodCall><methodName>wiki.getRPCVersionSupported</methodName><params></params></methodCall>'; +
- $.ajax({ +
-   url: "http://<your wiki>/wiki/lib/exe/xmlrpc.php", +
-   data: xml, +
-   contentType:"text/xml", +
-   type:"post", +
-   beforeSend: function (xhr) { +
-     xhr.setRequestHeader ("Authorization", "Basic " + btoa('username' + ":" + 'password')); +
-   }, +
- }); +
-</code> +
- +
-===== Python Module ===== +
-A Python module for DokuWiki's XML-RPC API can be found at the [[http://pypi.python.org/pypi?name=dokuwikixmlrpc&:action=display|Python package index]] and on [[https://github.com/kynan/dokuwikixmlrpc|GitHub]]. +
- +
-Alternative: [[http://python-dokuwiki.readthedocs.io/en/latest/|python-dokuwiki]] +
- +
- +
-===== Sample AutoIt3 Client ===== +
-My AutoIt3 client is mainly a proof of concept: +
- +
-<code autoit> +
-#cs ---------------------------------------------------------------------------- +
- +
- AutoIt Version: 3.2.12.1 +
- Author:         Hugo Bossard +
- +
- Script Function: +
-    XML-RPC sample client AutoIt3 script. +
- +
-#ce ---------------------------------------------------------------------------- +
- +
-; this script uses the UDF WinHttp +
-#include "WinHTTP.au3" +
- +
-; get the info from page 'wiki:syntax' using wiki.getPageInfo() +
-$Xml = '<?xml version="1.0"?>'  +
-$Xml = $Xml  & @CRLF & '<methodCall>' +
-$Xml = $Xml  & @CRLF & '<methodName>wiki.getPageInfo</methodName>' +
-$Xml = $Xml  & @CRLF & '<params>' +
-$Xml = $Xml  & @CRLF & '<param>'  +
-$Xml = $Xml  & @CRLF & '<value>' +
-$Xml = $Xml  & @CRLF & '<string>wiki:syntax</string>' +
-$Xml = $Xml  & @CRLF & '</value>' +
-$Xml = $Xml  & @CRLF & '</param>'  +
-$Xml = $Xml  & @CRLF & '</params>'  +
-$Xml = $Xml  & @CRLF & '</methodCall>' +
-$XmlSize = StringLen($Xml) +
- +
-; initializes the use of WinHTTP functions and returns a WinHTTP-session handle. +
-$hw_open = _WinHttpOpen() +
- +
-; creates a HTTP request handle to a lokal DokuWikiStick installation on port 8800 +
-$hw_connect = _WinHttpConnect($hw_open, "localhost", 8800) +
- +
-; creates a HTTP request handle +
-$h_openRequest = _WinHttpOpenRequest($hw_connect, "POST", "/lib/exe/xmlrpc.php", "/RPC2 HTTP/1.0", "localhost", "text/xml"+
- +
-; sends the specified request to the HTTP server +
-_WinHttpSendRequest($h_openRequest, "", $Xml, $XmlSize) +
- +
-; waits to receive the response to a HTTP request initiated by WinHttpSendRequest(). +
-_WinHttpReceiveResponse($h_openRequest) +
- +
-$Data = "" +
-Do +
-  ; reads data from a handle opened by the _WinHttpOpenRequest() function. +
-  $Data&=_WinHttpReadData($h_openRequest) +
-Until @error +
- +
-; close connection and clean up +
-_WinHttpCloseHandle($h_openRequest) +
-_WinHttpCloseHandle($hw_connect) +
-_WinHttpCloseHandle($hw_open) +
- +
-; show error number and resulting data +
-MsgBox(4096,"Error: " & @error, $Data) +
-</code> +
- +
-===== Sample Emacs Lisp Client ===== +
-<code lisp> +
- +
-(require 'xml-rpc) +
-(defvar *dokuwiki-xml-rpc-url* "https://dokuwiki.url/lib/exe/xmlrpc.php"+
-(xml-rpc-method-call +
-  *dokuwiki-xml-rpc-url* +
-  'dokuwiki.getTime) +
- +
-</code> +
- +
  
 +A number of [[devel:xmlrpc:clients|clients written in different languages]] are available.
devel/xmlrpc.1497444281.txt.gz · Last modified: 2017-06-14 14:44 by 80.156.250.234

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki