Compatible with DokuWiki
> 2008-03-31
JSON-RPC interface to interact with dokuwiki from other Programms using Ajax Request
Download and install the plugin using the Plugin Manager using the URL given above. Refer to Plugins on how to install plugins manually.
dokuwiki.getPagelist
Parameters (string) namespace, (array) options
Data (array) list of page items
Description Lists all pages within a given namespace. The options are passed directly to search_allpages().
dokuwiki.getVersion
dokuwiki.getTime
dokuwiki.login
dokuwiki.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
Description Performs a fulltext search
dokuwiki.getTitle
dokuwiki.appendPage
Name dokuwiki.appendPage
Parameters (string) pagename, (string) raw Wiki text, (array) attrs
params : [{string : “myPage”}, {string:“myText to add to myPage \n next line”}] (dokuwiki syntax)
Where attrs can contain the following:
Data (boolean)
Description Appends text to a Wiki Page.
dokuwiki.setLocks
Parameters (array) list of two lists of page [array('lock'⇒array(…), 'unlock'⇒array(…))],
Data (array) array with 4 lists of pageids array('locked'⇒array(…), 'lockfail'⇒array(…), 'unlocked'⇒array(…), 'unlockfail'⇒array(…))
Description Allows you to lock or unlock a whole bunch of pages at once. Useful when you are about to do a operation over multiple pages
wiki.getPage
Parameters (string) pagename
Data (string) raw Wiki text
Description Returns the raw Wiki text for a page.
wiki.getPageVersion
Parameters (string) pagename, (string) Timestamp
Data (string) raw Wiki text
Description Returns the raw Wiki text for a specific revision of a Wiki page.
wiki.getPageVersions
Parameters (string) pagename, (string) firstPage(timestamp)
Data (array) each array item holds the following data:
$data['user'] = username
$data['ip'] = ip address
$data['type'] = type of change
$data['sum'] = summary
$data['modified'] = modification date as UTC timestamp
$data['version'] = page version as timestamp
Description Returns the available versions of a Wiki page. The number of pages in the result is controlled via the recent configuration setting. The offset can be used to list earlier versions in the history.
wiki.getPageInfo
Parameters (string) pagename
Data (array) an array containing the following data:
-
$data['lastModified'] = modifaction date as UTC timestamp
$data['author'] = author of the Wiki page.
$data['version'] = page version as timestamp
Description Returns information about a Wiki page.
wiki.getPageInfoVersion
Parameters (string) pagename, (string) timestamp
Data (array) an array containing the following data:
-
$data['lastModified'] = modification date as UTC timestamp
$data['author'] = author of the Wiki page.
$data['version'] = page version as timestamp
Description Returns information about a specific version of a Wiki page.
wiki.getPageHTML
wiki.getPageHTMLVersion
wiki.putPage
Parameters (string) pagename, (string) raw Wiki text, (array) attrs
params : [{string : “myPage”}, {string : ”==== MyNewPage ==== \nThis is my new Page”}]
Where attrs can contain the following:
Data (boolean)
Description Saves a Wiki Page.
wiki.listLinks
Parameters (string) pagename
Data (array) each array item holds the following data:
Description Returns a list of all links contained in a Wiki page.
wiki.getAllPages
Parameters -
Data (array) One item for each page, each item containing the following data:
$data['id'] = id of the page
$data['perms'] = integer denoting the permissions on the page
$data['size'] = size in bytes
$data['lastModified'] = dateTime object of last modification date
Description Returns a list of all Wiki pages in the remote Wiki.
wiki.getBackLinks
wiki.getRecentChanges
Name wiki.getRecentChanges
Parameters (string) timestamp
Data (array) each array item holds the following data:
Description Returns a list of recent changes since given timestamp.
wiki.getAttachments
Parameters (String) namespace, (array) options
Data (array) each array item holds the following data:
$data['id'] = media id
$data['size'] = size in bytes
$data['lastModified'] = modification date as XMLRPC Date object
$data['isimg'] = true if file is an image, false otherwise
$data['writable'] = true if file is writable, false otherwise
$data['perms'] = permissions of file
Description Returns a list of media files in a given namespace.
Available options are:
$options['recursive'] = true if also files in subnamespaces are to be included, defaults to false
$options['pattern'] = an optional PREG compatible regexp which has to match the file id
wiki.getAttachment
Parameters (String) id
Data (base64) the data of the file, encoded in base64
Description Returns the binary data of a media file
wiki.getAttachmentInfo
wiki.putAttachment
Parameters (String) id, (base64) data, (array) params (optional)
Data -
Description Uploads a file as a given media id. Available parameters are:
$params['ow'] = true if file is to overwrite an already existing media object of the given id
wiki.deleteAttachment
Serverresponse, properties:
result - return object (if(error)result = null)
error - error object, if failure, else = null
code: error code as integer
message: description of the error
data: additional info about errors
id - same id as id in Request
| Code | Message | Description |
| -32700 | Parse error | Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text. |
| -32600 | Invalid Request | The JSON sent is not a valid Request object. |
| -32601 | Method not found | The method does not exist / is not available. |
| -32602 | Invalid params | Invalid method parameter(s). |
| -32603 | Internal error | Internal JSON-RPC error. |
| -32099 to -32000 | Server error | Reserved for implementation-defined server-errors. |
YUI().use("io-base", function(Y) {
var uri = sUrl + 'Your/Path/To/DokuWiki/lib/plugins/jsonrpc/jsonrpc.php';
var js_request = {
jsonrpc: '2.0',
id: '',
method : {
methodName : 'wiki.putPage'
},
params : [
{string : 'myNamespace:myPage'},
{string : "==== myPage ==== \n This is my new Page!"}
]};
var json_request = YAHOO.lang.JSON.stringify(js_request);
var cfg = {
method: 'POST',
data:json_request,
headers: {
'Content-Type':'application/json'
},
arguments: p.obj
}
var request = Y.io(uri,cfg);
});