Skip to content

AndyDLP/PSDokuWiki

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PSDokuWiki Build statusAppVeyor testsPowerShell Gallery

PSDokuWiki is a (WIP) PowerShell wrapper for DokuWiki's XML RPC API

How to install

(Recommended) From the powershell gallery

Install-Module -Name 'PSDokuWiki' -Repository 'PSGallery' -Force

(Not recommended) You can also clone this repository and copy the .\PSDokuWiki folder to one of the module folders in your $env:PSModulePath

How to use

Firstly you will need to connect to the API endpoint as per the below. Using these defaults this will attempt to authenticate to: https://wiki.example.com/lib/exe/xmlrpc.php and forcibly overwrite any existing connections

# Connect to the API
Connect-DokuServer -ComputerName 'wiki.example.com' -Credential (Get-Credential) -Force

You can also connect to unencrypted endpoints (http) by using the -Unencrypted switch & also specify a different path to the XMLRPC endpoint (for example when using a different virtual host / path on your webserver)

# Connect to the API
Connect-DokuServer -ComputerName 'wiki.example.com' -Credential (Get-Credential) -Unencrypted -APIPath '/dokuwiki/lib/exe/xmlrpc.php'

You can then use any of the other commands as normal

# Get raw / plain source text of the specified page
Get-DokuPageData -FullName 'namespace1:namespace2:page' -Raw

You can also use Invoke-DokuApiCall to use any other available API method that plugins expose, see example below with the struct plugin:

# Get the structured data for namespace1:page, for all schemas ('') at the present time (0)
Invoke-DokuApiCall -MethodName 'plugin.struct.getData' -MethodParameters @('namespace1:page','',0)

Fault codes

Fault codes generated by the DokuWiki API

  • //100 -> Page errors//
    • //110 -> Page access errors//
      • 111 -> User is not allowed to read the requested page
      • 112 -> User is not allowed to edit the page
      • 113 -> manager permission is required
      • 114 -> superuser permission is required
    • //120 -> Page existence errors//
      • 121 -> The requested page does not exist
    • //130 -> Page edit errors//
      • 131 -> Empty page id
      • 132 -> Empty page content
      • 133 -> Page is locked
      • 134 -> Positive wordblock check
  • //200 -> Media errors//
    • //210 -> Media access errors//
      • 211 -> User is not allowed to read the requested media
      • 212 -> User is not allowed to delete media
      • 215 -> User is not allowed to list media
    • //220 -> Media existence errors//
      • 221 -> The requested media does not exist
    • //230 -> Media edit errors//
      • 231 -> Filename not given
      • 232 -> File is still referenced
      • 233 -> Could not delete file
  • //300 -> Search errors//
    • //310 -> Argument errors//
      • 311 -> The provided value is not a valid timestamp
    • //320 -> Search result errors//
      • 321 -> No changes in specified timeframe

Additionally there are some server error codes that indicate some kind of server or XML-RPC failure. The codes are the following:

  • -32600 -> Invalid XML-RPC request. Not conforming to specification.
  • -32601 -> Requested method does not exist.
  • -32602 -> Wrong number of parameters or invalid method parameters.
  • -32603 -> Not authorized to call the requested method (No login or invalid login data was given).
  • -32604 -> Forbidden to call the requested method (but a valid login was given).
  • -32605 -> The XML-RPC API has not been enabled in the configuration
  • -32700 -> Parse Error. Request not well formed.
  • -32800 -> Recursive calls to system.multicall are forbidden.
  • -99999 -> Unknown server error.