15ee96713SAndreas Gohr<?php 25ee96713SAndreas Gohr 3d3856637SAndreas Gohruse dokuwiki\Remote\OpenApiDoc\OpenAPIGenerator; 45ee96713SAndreas Gohr 5d3856637SAndreas Gohrif (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../'); 65ee96713SAndreas Gohrrequire_once(DOKU_INC . 'inc/init.php'); 75ee96713SAndreas Gohrglobal $INPUT; 85ee96713SAndreas Gohr 95ee96713SAndreas Gohrif ($INPUT->has('spec')) { 105ee96713SAndreas Gohr header('Content-Type: application/json'); 11d3856637SAndreas Gohr $apigen = new OpenAPIGenerator(); 125ee96713SAndreas Gohr echo $apigen->generate(); 135ee96713SAndreas Gohr exit(); 145ee96713SAndreas Gohr} 155ee96713SAndreas Gohr?> 165ee96713SAndreas Gohr<!doctype html> 175ee96713SAndreas Gohr<html lang="en"> 185ee96713SAndreas Gohr<head> 195ee96713SAndreas Gohr <meta charset="utf-8"> 20cd0c7c3aSAndreas Gohr <title>DokuWiki API Explorer</title> 210c6e9178SAndreas Gohr <script src="https://unpkg.com/openapi-explorer/dist/browser/openapi-explorer.min.js" type="module" 220c6e9178SAndreas Gohr defer=""></script> 235ee96713SAndreas Gohr <style> 245ee96713SAndreas Gohr body { 255ee96713SAndreas Gohr font-family: sans-serif; 265ee96713SAndreas Gohr } 275ee96713SAndreas Gohr </style> 285ee96713SAndreas Gohr</head> 295ee96713SAndreas Gohr<body> 305ee96713SAndreas Gohr<openapi-explorer 315ee96713SAndreas Gohr spec-url="<?php echo DOKU_URL ?>lib/exe/openapi.php?spec=1" 325ee96713SAndreas Gohr hide-server-selection="true" 335ee96713SAndreas Gohr use-path-in-nav-bar="true" 340c6e9178SAndreas Gohr> 350c6e9178SAndreas Gohr <div slot="overview-api-description"> 360c6e9178SAndreas Gohr <p> 370c6e9178SAndreas Gohr This is an auto generated description and OpenAPI specification for the 380c6e9178SAndreas Gohr <a href="https://www.dokuwiki.org/devel/jsonrpc">DokuWiki JSON-RPC API</a>. 390c6e9178SAndreas Gohr It is generated from the source code and the inline documentation. 400c6e9178SAndreas Gohr </p> 410c6e9178SAndreas Gohr 420c6e9178SAndreas Gohr <p> 430c6e9178SAndreas Gohr <a href="<?php echo DOKU_BASE ?>/lib/exe/openapi.php?spec=1" download="dokuwiki.json">Download 440c6e9178SAndreas Gohr the API Spec</a> 450c6e9178SAndreas Gohr </p> 460c6e9178SAndreas Gohr 47d3856637SAndreas Gohr <h3>Error Codes</h3> 48d3856637SAndreas Gohr 49d3856637SAndreas Gohr <p> 50d3856637SAndreas Gohr The following error codes are currently used in the core methods. This list may be incomplete 51d3856637SAndreas Gohr or change in the future. 52d3856637SAndreas Gohr </p> 53d3856637SAndreas Gohr 54d3856637SAndreas Gohr <table> 55d3856637SAndreas Gohr <tr><th>Code</th><th>Message</th></tr> 56d3856637SAndreas Gohr <tr><td>0</td><td>Success</td></tr> 57d3856637SAndreas Gohr <?php 58d3856637SAndreas Gohr $apigen = new OpenAPIGenerator(); 59d3856637SAndreas Gohr $last = 0; 60d3856637SAndreas Gohr foreach ($apigen->getErrorCodes() as $code) { 61d3856637SAndreas Gohr // duplicate codes are only shown with debug 62d3856637SAndreas Gohr if($code['code'] === $last && !$INPUT->has('debug')) continue; 63*7625c995SAndreas Gohr $last = $code['code']; 64d3856637SAndreas Gohr echo '<tr><td>' . $code['code'] . '</td><td>' . hsc($code['message']) . '</td></tr>'; 65d3856637SAndreas Gohr } 66d3856637SAndreas Gohr ?> 67d3856637SAndreas Gohr </table> 680c6e9178SAndreas Gohr </div> 690c6e9178SAndreas Gohr 700c6e9178SAndreas Gohr <div slot="authentication-footer"> 710c6e9178SAndreas Gohr <p> 720c6e9178SAndreas Gohr <?php 730c6e9178SAndreas Gohr if ($INPUT->server->has('REMOTE_USER')) { 740c6e9178SAndreas Gohr echo 'You are currently logged in as <strong>' . hsc($INPUT->server->str('REMOTE_USER')) . '</strong>.'; 750c6e9178SAndreas Gohr echo '<br>API calls in this tool will be automatically executed with your permissions.'; 760c6e9178SAndreas Gohr } else { 770c6e9178SAndreas Gohr echo 'You are currently not logged in.<br>'; 780c6e9178SAndreas Gohr echo 'You can provide credentials above.'; 790c6e9178SAndreas Gohr } 800c6e9178SAndreas Gohr ?> 810c6e9178SAndreas Gohr </p> 820c6e9178SAndreas Gohr </div> 830c6e9178SAndreas Gohr</openapi-explorer> 845ee96713SAndreas Gohr</body> 855ee96713SAndreas Gohr</html> 865ee96713SAndreas Gohr 875ee96713SAndreas Gohr 88