3 use dokuwiki\Remote\OpenApiDoc\OpenAPIGenerator
;
5 if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__
. '/../../');
6 require_once(DOKU_INC
. 'inc/init.php');
9 if ($INPUT->has('spec')) {
10 header('Content-Type: application/json');
11 $apigen = new OpenAPIGenerator();
12 echo $apigen->generate();
19 <meta charset
="utf-8">
20 <title
>DokuWiki API Explorer
</title
>
21 <script src
="https://unpkg.com/openapi-explorer/dist/browser/openapi-explorer.min.js" type
="module"
25 font
-family
: sans
-serif
;
31 spec
-url
="<?php echo DOKU_URL ?>lib/exe/openapi.php?spec=1"
32 hide
-server
-selection
="true"
33 use-path
-in
-nav
-bar
="true"
35 <div slot
="overview-api-description">
37 This is an auto generated description
and OpenAPI specification
for the
38 <a href
="https://www.dokuwiki.org/devel/jsonrpc">DokuWiki JSON
-RPC API
</a
>.
39 It is generated from the source code
and the inline documentation
.
43 <a href
="<?php echo DOKU_BASE ?>/lib/exe/openapi.php?spec=1" download
="dokuwiki.json">Download
50 The following error codes are currently used in the core methods
. This
list may be incomplete
51 or change in the future
.
55 <tr
><th
>Code
</th
><th
>Message
</th
></tr
>
56 <tr
><td
>0</td
><td
>Success
</td
></tr
>
58 $apigen = new OpenAPIGenerator();
60 foreach ($apigen->getErrorCodes() as $code) {
61 // duplicate codes are only shown with debug
62 if($code['code'] === $last && !$INPUT->has('debug')) continue;
63 echo '<tr><td>' . $code['code'] . '</td><td>' . hsc($code['message']) . '</td></tr>';
69 <div slot
="authentication-footer">
72 if ($INPUT->server
->has('REMOTE_USER')) {
73 echo 'You are currently logged in as <strong>' . hsc($INPUT->server
->str('REMOTE_USER')) . '</strong>.';
74 echo '<br>API calls in this tool will be automatically executed with your permissions.';
76 echo 'You are currently not logged in.<br>';
77 echo 'You can provide credentials above.';