@section('body')
- <div class="container pt-xl">
+ <div component="api-nav" class="container">
<div class="grid right-focus reverse-collapse">
<div>
- <div class="sticky-sidebar">
- <p class="text-uppercase text-muted mb-xm mt-l"><strong>Getting Started</strong></p>
+ <div refs="api-nav@sidebar" class="sticky-sidebar">
- <div class="text-mono">
- <div class="mb-xs"><a href="#authentication">Authentication</a></div>
- <div class="mb-xs"><a href="#request-format">Request Format</a></div>
- <div class="mb-xs"><a href="#listing-endpoints">Listing Endpoints</a></div>
- <div class="mb-xs"><a href="#error-handling">Error Handling</a></div>
- <div class="mb-xs"><a href="#rate-limits">Rate Limits</a></div>
- <div class="mb-xs"><a href="#content-security">Content Security</a></div>
+ <div class="sticky-sidebar-header py-xl">
+ <select refs="api-nav@select" name="navigation" id="navigation">
+ <option value="getting-started" selected>Jump To Section</option>
+ <option value="getting-started">Getting Started</option>
+ @foreach($docs as $model => $endpoints)
+ <option value="{{ str_replace(' ', '-', $model) }}">{{ ucfirst($model) }}</option>
+ @if($model === 'docs' || $model === 'shelves')
+ <hr>
+ @endif
+ @endforeach
+ </select>
+ </div>
+
+ <div class="mb-xl">
+ <p id="sidebar-header-getting-started" class="text-uppercase text-muted mb-xm"><strong>Getting Started</strong></p>
+ <div class="text-mono">
+ <div class="mb-xs"><a href="#authentication">Authentication</a></div>
+ <div class="mb-xs"><a href="#request-format">Request Format</a></div>
+ <div class="mb-xs"><a href="#listing-endpoints">Listing Endpoints</a></div>
+ <div class="mb-xs"><a href="#error-handling">Error Handling</a></div>
+ <div class="mb-xs"><a href="#rate-limits">Rate Limits</a></div>
+ <div class="mb-xs"><a href="#content-security">Content Security</a></div>
+ </div>
</div>
@foreach($docs as $model => $endpoints)
- <p class="text-uppercase text-muted mb-xm mt-l"><strong>{{ $model }}</strong></p>
+ <div class="mb-xl">
+ <p id="sidebar-header-{{ str_replace(' ', '-', $model) }}" class="text-uppercase text-muted mb-xm"><strong>{{ $model }}</strong></p>
- @foreach($endpoints as $endpoint)
- <div class="mb-xs">
- <a href="#{{ $endpoint['name'] }}" class="text-mono inline block mr-s">
- <span class="api-method" data-method="{{ $endpoint['method'] }}">{{ $endpoint['method'] }}</span>
- </a>
- <a href="#{{ $endpoint['name'] }}" class="text-mono">
- {{ $endpoint['controller_method_kebab'] }}
- </a>
- </div>
- @endforeach
+ @foreach($endpoints as $endpoint)
+ <div class="mb-xs">
+ <a href="#{{ $endpoint['name'] }}" class="text-mono inline block mr-s">
+ <span class="api-method" data-method="{{ $endpoint['method'] }}">{{ $endpoint['method'] }}</span>
+ </a>
+ <a href="#{{ $endpoint['name'] }}" class="text-mono">
+ {{ $endpoint['controller_method_kebab'] }}
+ </a>
+ </div>
+ @endforeach
+ </div>
@endforeach
</div>
</div>
- <div style="overflow: auto;">
+ <div class="pt-xl" style="overflow: auto;">
- <section component="code-highlighter" class="card content-wrap auto-height">
+ <section id="section-getting-started" component="code-highlighter" class="card content-wrap auto-height">
@include('api-docs.parts.getting-started')
</section>
@foreach($docs as $model => $endpoints)
- <section class="card content-wrap auto-height">
+ <section id="section-{{ str_replace(' ', '-', $model) }}" class="card content-wrap auto-height">
<h1 class="list-heading text-capitals">{{ $model }}</h1>
@if($endpoints[0]['model_description'])
<p>{{ $endpoints[0]['model_description'] }}</p>
/**
* Routes for the BookStack API.
- * Routes have a uri prefix of /api/.
+ * Routes have a URI prefix of /api/.
* Controllers all end with "ApiController"
*/
use BookStack\Users\Controllers\UserApiController;
use Illuminate\Support\Facades\Route;
-Route::get('docs.json', [ApiDocsController::class, 'json']);
-
-Route::get('attachments', [AttachmentApiController::class, 'list']);
-Route::post('attachments', [AttachmentApiController::class, 'create']);
-Route::get('attachments/{id}', [AttachmentApiController::class, 'read']);
-Route::put('attachments/{id}', [AttachmentApiController::class, 'update']);
-Route::delete('attachments/{id}', [AttachmentApiController::class, 'delete']);
+// Main Entity Routes
-Route::get('books', [EntityControllers\BookApiController::class, 'list']);
-Route::post('books', [EntityControllers\BookApiController::class, 'create']);
-Route::get('books/{id}', [EntityControllers\BookApiController::class, 'read']);
-Route::put('books/{id}', [EntityControllers\BookApiController::class, 'update']);
-Route::delete('books/{id}', [EntityControllers\BookApiController::class, 'delete']);
-
-Route::get('books/{id}/export/html', [ExportControllers\BookExportApiController::class, 'exportHtml']);
-Route::get('books/{id}/export/pdf', [ExportControllers\BookExportApiController::class, 'exportPdf']);
-Route::get('books/{id}/export/plaintext', [ExportControllers\BookExportApiController::class, 'exportPlainText']);
-Route::get('books/{id}/export/markdown', [ExportControllers\BookExportApiController::class, 'exportMarkdown']);
-Route::get('books/{id}/export/zip', [ExportControllers\BookExportApiController::class, 'exportZip']);
+Route::get('pages', [EntityControllers\PageApiController::class, 'list']);
+Route::post('pages', [EntityControllers\PageApiController::class, 'create']);
+Route::get('pages/{id}', [EntityControllers\PageApiController::class, 'read']);
+Route::put('pages/{id}', [EntityControllers\PageApiController::class, 'update']);
+Route::delete('pages/{id}', [EntityControllers\PageApiController::class, 'delete']);
+Route::get('pages/{id}/export/html', [ExportControllers\PageExportApiController::class, 'exportHtml']);
+Route::get('pages/{id}/export/pdf', [ExportControllers\PageExportApiController::class, 'exportPdf']);
+Route::get('pages/{id}/export/plaintext', [ExportControllers\PageExportApiController::class, 'exportPlainText']);
+Route::get('pages/{id}/export/markdown', [ExportControllers\PageExportApiController::class, 'exportMarkdown']);
+Route::get('pages/{id}/export/zip', [ExportControllers\PageExportApiController::class, 'exportZip']);
Route::get('chapters', [EntityControllers\ChapterApiController::class, 'list']);
Route::post('chapters', [EntityControllers\ChapterApiController::class, 'create']);
Route::get('chapters/{id}/export/markdown', [ExportControllers\ChapterExportApiController::class, 'exportMarkdown']);
Route::get('chapters/{id}/export/zip', [ExportControllers\ChapterExportApiController::class, 'exportZip']);
-Route::get('pages', [EntityControllers\PageApiController::class, 'list']);
-Route::post('pages', [EntityControllers\PageApiController::class, 'create']);
-Route::get('pages/{id}', [EntityControllers\PageApiController::class, 'read']);
-Route::put('pages/{id}', [EntityControllers\PageApiController::class, 'update']);
-Route::delete('pages/{id}', [EntityControllers\PageApiController::class, 'delete']);
+Route::get('books', [EntityControllers\BookApiController::class, 'list']);
+Route::post('books', [EntityControllers\BookApiController::class, 'create']);
+Route::get('books/{id}', [EntityControllers\BookApiController::class, 'read']);
+Route::put('books/{id}', [EntityControllers\BookApiController::class, 'update']);
+Route::delete('books/{id}', [EntityControllers\BookApiController::class, 'delete']);
+Route::get('books/{id}/export/html', [ExportControllers\BookExportApiController::class, 'exportHtml']);
+Route::get('books/{id}/export/pdf', [ExportControllers\BookExportApiController::class, 'exportPdf']);
+Route::get('books/{id}/export/plaintext', [ExportControllers\BookExportApiController::class, 'exportPlainText']);
+Route::get('books/{id}/export/markdown', [ExportControllers\BookExportApiController::class, 'exportMarkdown']);
+Route::get('books/{id}/export/zip', [ExportControllers\BookExportApiController::class, 'exportZip']);
-Route::get('pages/{id}/export/html', [ExportControllers\PageExportApiController::class, 'exportHtml']);
-Route::get('pages/{id}/export/pdf', [ExportControllers\PageExportApiController::class, 'exportPdf']);
-Route::get('pages/{id}/export/plaintext', [ExportControllers\PageExportApiController::class, 'exportPlainText']);
-Route::get('pages/{id}/export/markdown', [ExportControllers\PageExportApiController::class, 'exportMarkdown']);
-Route::get('pages/{id}/export/zip', [ExportControllers\PageExportApiController::class, 'exportZip']);
+Route::get('shelves', [EntityControllers\BookshelfApiController::class, 'list']);
+Route::post('shelves', [EntityControllers\BookshelfApiController::class, 'create']);
+Route::get('shelves/{id}', [EntityControllers\BookshelfApiController::class, 'read']);
+Route::put('shelves/{id}', [EntityControllers\BookshelfApiController::class, 'update']);
+Route::delete('shelves/{id}', [EntityControllers\BookshelfApiController::class, 'delete']);
-Route::get('image-gallery', [ImageGalleryApiController::class, 'list']);
-Route::post('image-gallery', [ImageGalleryApiController::class, 'create']);
-Route::get('image-gallery/url/data', [ImageGalleryApiController::class, 'readDataForUrl']);
-Route::get('image-gallery/{id}', [ImageGalleryApiController::class, 'read']);
-Route::get('image-gallery/{id}/data', [ImageGalleryApiController::class, 'readData']);
-Route::put('image-gallery/{id}', [ImageGalleryApiController::class, 'update']);
-Route::delete('image-gallery/{id}', [ImageGalleryApiController::class, 'delete']);
+// Additional Model Routes, in alphabetical order
-Route::get('search', [SearchApiController::class, 'all']);
+Route::get('attachments', [AttachmentApiController::class, 'list']);
+Route::post('attachments', [AttachmentApiController::class, 'create']);
+Route::get('attachments/{id}', [AttachmentApiController::class, 'read']);
+Route::put('attachments/{id}', [AttachmentApiController::class, 'update']);
+Route::delete('attachments/{id}', [AttachmentApiController::class, 'delete']);
+
+Route::get('audit-log', [ActivityControllers\AuditLogApiController::class, 'list']);
Route::get('comments', [ActivityControllers\CommentApiController::class, 'list']);
Route::post('comments', [ActivityControllers\CommentApiController::class, 'create']);
Route::put('comments/{id}', [ActivityControllers\CommentApiController::class, 'update']);
Route::delete('comments/{id}', [ActivityControllers\CommentApiController::class, 'delete']);
-Route::get('shelves', [EntityControllers\BookshelfApiController::class, 'list']);
-Route::post('shelves', [EntityControllers\BookshelfApiController::class, 'create']);
-Route::get('shelves/{id}', [EntityControllers\BookshelfApiController::class, 'read']);
-Route::put('shelves/{id}', [EntityControllers\BookshelfApiController::class, 'update']);
-Route::delete('shelves/{id}', [EntityControllers\BookshelfApiController::class, 'delete']);
+Route::get('content-permissions/{contentType}/{contentId}', [ContentPermissionApiController::class, 'read']);
+Route::put('content-permissions/{contentType}/{contentId}', [ContentPermissionApiController::class, 'update']);
-Route::get('users', [UserApiController::class, 'list']);
-Route::post('users', [UserApiController::class, 'create']);
-Route::get('users/{id}', [UserApiController::class, 'read']);
-Route::put('users/{id}', [UserApiController::class, 'update']);
-Route::delete('users/{id}', [UserApiController::class, 'delete']);
+Route::get('docs.json', [ApiDocsController::class, 'json']);
-Route::get('roles', [RoleApiController::class, 'list']);
-Route::post('roles', [RoleApiController::class, 'create']);
-Route::get('roles/{id}', [RoleApiController::class, 'read']);
-Route::put('roles/{id}', [RoleApiController::class, 'update']);
-Route::delete('roles/{id}', [RoleApiController::class, 'delete']);
+Route::get('image-gallery', [ImageGalleryApiController::class, 'list']);
+Route::post('image-gallery', [ImageGalleryApiController::class, 'create']);
+Route::get('image-gallery/url/data', [ImageGalleryApiController::class, 'readDataForUrl']);
+Route::get('image-gallery/{id}', [ImageGalleryApiController::class, 'read']);
+Route::get('image-gallery/{id}/data', [ImageGalleryApiController::class, 'readData']);
+Route::put('image-gallery/{id}', [ImageGalleryApiController::class, 'update']);
+Route::delete('image-gallery/{id}', [ImageGalleryApiController::class, 'delete']);
Route::get('imports', [ExportControllers\ImportApiController::class, 'list']);
Route::post('imports', [ExportControllers\ImportApiController::class, 'create']);
Route::put('recycle-bin/{deletionId}', [EntityControllers\RecycleBinApiController::class, 'restore']);
Route::delete('recycle-bin/{deletionId}', [EntityControllers\RecycleBinApiController::class, 'destroy']);
-Route::get('content-permissions/{contentType}/{contentId}', [ContentPermissionApiController::class, 'read']);
-Route::put('content-permissions/{contentType}/{contentId}', [ContentPermissionApiController::class, 'update']);
+Route::get('roles', [RoleApiController::class, 'list']);
+Route::post('roles', [RoleApiController::class, 'create']);
+Route::get('roles/{id}', [RoleApiController::class, 'read']);
+Route::put('roles/{id}', [RoleApiController::class, 'update']);
+Route::delete('roles/{id}', [RoleApiController::class, 'delete']);
-Route::get('audit-log', [ActivityControllers\AuditLogApiController::class, 'list']);
+Route::get('search', [SearchApiController::class, 'all']);
Route::get('system', [SystemApiController::class, 'read']);
+
+Route::get('users', [UserApiController::class, 'list']);
+Route::post('users', [UserApiController::class, 'create']);
+Route::get('users/{id}', [UserApiController::class, 'read']);
+Route::put('users/{id}', [UserApiController::class, 'update']);
+Route::delete('users/{id}', [UserApiController::class, 'delete']);