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 [2021-09-20 16:50] – add php-xml package basebuilderdevel:xmlrpc [2024-01-31 23:57] (current) – [Adding methods to the XML-RPC API] Klap-in
Line 1: Line 1:
 ====== XML-RPC ====== ====== XML-RPC ======
  
-DokuWiki has a [[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]]. Plugins can add their own calls to the API using [[devel:remote_plugins|Remote Plugin components]].
  
-Questions and suggestions to extend and improve the API should be directed to the [[:mailinglist]].+Note: there is also a [[jsonrpc|JSON-RPC]] API which provides the same functionality but is based on JSON rather XML. 
  
 ===== Get It Working ===== ===== Get It Working =====
  
-  - You need at least the 2008-03-31 release of DokuWiki. 
   - Set the [[config:remote]] option to enable XML-RPC in the Configuration Settings "Authentication" section   - Set the [[config:remote]] option to enable XML-RPC in the Configuration Settings "Authentication" section
   - Set the [[config:remoteuser]] option with a mix of comma separated "usernames,groups"    - Set the [[config:remoteuser]] option with a mix of comma separated "usernames,groups" 
Line 41: 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 63: 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>This is my page content</string> +                <string>This is my page content</string> 
- </value> +            </value> 
- </param> +        </param> 
- <param>  +        <param>  
- <value> +            <value> 
- <struct> +                <struct> 
- <member> +                    <member> 
- <name>sum</name> +                        <name>sum</name> 
- <value><string>Spiceworks</string></value> +                        <value><string>Spiceworks</string></value> 
- </member> +                    </member> 
- <member> +                    <member> 
- <name>minor</name> +                        <name>minor</name> 
- <value><boolean>True</boolean></value> +                        <value><boolean>True</boolean></value> 
- </member> +                    </member> 
- </struct> +                </struct> 
- </value> +            </value> 
- </param>  +        </param>  
- </params> +    </params> 
 </methodCall> </methodCall>
 </code> </code>
Line 165: 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' => [...] 
 +    '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. | ^ 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 ==== ==== dokuwiki.deleteUsers ====
Line 205: 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 
 +$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.  | ^ 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.  |
  
Line 323: Line 358:
 ==== 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 332: 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 348: Line 390:
 =====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 384: 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:
devel/xmlrpc.1632149410.txt.gz · Last modified: 2021-09-20 16:50 by basebuilder

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