4 * Routes for the BookStack API.
5 * Routes have a URI prefix of /api/.
6 * Controllers all end with "ApiController"
9 use BookStack\Activity\Controllers as ActivityControllers;
10 use BookStack\Api\ApiDocsController;
11 use BookStack\App\SystemApiController;
12 use BookStack\Entities\Controllers as EntityControllers;
13 use BookStack\Exports\Controllers as ExportControllers;
14 use BookStack\Permissions\ContentPermissionApiController;
15 use BookStack\Search\SearchApiController;
16 use BookStack\Uploads\Controllers\AttachmentApiController;
17 use BookStack\Uploads\Controllers\ImageGalleryApiController;
18 use BookStack\Users\Controllers\RoleApiController;
19 use BookStack\Users\Controllers\UserApiController;
20 use Illuminate\Support\Facades\Route;
24 Route::get('pages', [EntityControllers\PageApiController::class, 'list']);
25 Route::post('pages', [EntityControllers\PageApiController::class, 'create']);
26 Route::get('pages/{id}', [EntityControllers\PageApiController::class, 'read']);
27 Route::put('pages/{id}', [EntityControllers\PageApiController::class, 'update']);
28 Route::delete('pages/{id}', [EntityControllers\PageApiController::class, 'delete']);
29 Route::get('pages/{id}/export/html', [ExportControllers\PageExportApiController::class, 'exportHtml']);
30 Route::get('pages/{id}/export/pdf', [ExportControllers\PageExportApiController::class, 'exportPdf']);
31 Route::get('pages/{id}/export/plaintext', [ExportControllers\PageExportApiController::class, 'exportPlainText']);
32 Route::get('pages/{id}/export/markdown', [ExportControllers\PageExportApiController::class, 'exportMarkdown']);
33 Route::get('pages/{id}/export/zip', [ExportControllers\PageExportApiController::class, 'exportZip']);
35 Route::get('chapters', [EntityControllers\ChapterApiController::class, 'list']);
36 Route::post('chapters', [EntityControllers\ChapterApiController::class, 'create']);
37 Route::get('chapters/{id}', [EntityControllers\ChapterApiController::class, 'read']);
38 Route::put('chapters/{id}', [EntityControllers\ChapterApiController::class, 'update']);
39 Route::delete('chapters/{id}', [EntityControllers\ChapterApiController::class, 'delete']);
40 Route::get('chapters/{id}/export/html', [ExportControllers\ChapterExportApiController::class, 'exportHtml']);
41 Route::get('chapters/{id}/export/pdf', [ExportControllers\ChapterExportApiController::class, 'exportPdf']);
42 Route::get('chapters/{id}/export/plaintext', [ExportControllers\ChapterExportApiController::class, 'exportPlainText']);
43 Route::get('chapters/{id}/export/markdown', [ExportControllers\ChapterExportApiController::class, 'exportMarkdown']);
44 Route::get('chapters/{id}/export/zip', [ExportControllers\ChapterExportApiController::class, 'exportZip']);
46 Route::get('books', [EntityControllers\BookApiController::class, 'list']);
47 Route::post('books', [EntityControllers\BookApiController::class, 'create']);
48 Route::get('books/{id}', [EntityControllers\BookApiController::class, 'read']);
49 Route::put('books/{id}', [EntityControllers\BookApiController::class, 'update']);
50 Route::delete('books/{id}', [EntityControllers\BookApiController::class, 'delete']);
51 Route::get('books/{id}/export/html', [ExportControllers\BookExportApiController::class, 'exportHtml']);
52 Route::get('books/{id}/export/pdf', [ExportControllers\BookExportApiController::class, 'exportPdf']);
53 Route::get('books/{id}/export/plaintext', [ExportControllers\BookExportApiController::class, 'exportPlainText']);
54 Route::get('books/{id}/export/markdown', [ExportControllers\BookExportApiController::class, 'exportMarkdown']);
55 Route::get('books/{id}/export/zip', [ExportControllers\BookExportApiController::class, 'exportZip']);
57 Route::get('shelves', [EntityControllers\BookshelfApiController::class, 'list']);
58 Route::post('shelves', [EntityControllers\BookshelfApiController::class, 'create']);
59 Route::get('shelves/{id}', [EntityControllers\BookshelfApiController::class, 'read']);
60 Route::put('shelves/{id}', [EntityControllers\BookshelfApiController::class, 'update']);
61 Route::delete('shelves/{id}', [EntityControllers\BookshelfApiController::class, 'delete']);
63 // Additional Model Routes, in alphabetical order
65 Route::get('attachments', [AttachmentApiController::class, 'list']);
66 Route::post('attachments', [AttachmentApiController::class, 'create']);
67 Route::get('attachments/{id}', [AttachmentApiController::class, 'read']);
68 Route::put('attachments/{id}', [AttachmentApiController::class, 'update']);
69 Route::delete('attachments/{id}', [AttachmentApiController::class, 'delete']);
71 Route::get('audit-log', [ActivityControllers\AuditLogApiController::class, 'list']);
73 Route::get('comments', [ActivityControllers\CommentApiController::class, 'list']);
74 Route::post('comments', [ActivityControllers\CommentApiController::class, 'create']);
75 Route::get('comments/{id}', [ActivityControllers\CommentApiController::class, 'read']);
76 Route::put('comments/{id}', [ActivityControllers\CommentApiController::class, 'update']);
77 Route::delete('comments/{id}', [ActivityControllers\CommentApiController::class, 'delete']);
79 Route::get('content-permissions/{contentType}/{contentId}', [ContentPermissionApiController::class, 'read']);
80 Route::put('content-permissions/{contentType}/{contentId}', [ContentPermissionApiController::class, 'update']);
82 Route::get('docs.json', [ApiDocsController::class, 'json']);
84 Route::get('image-gallery', [ImageGalleryApiController::class, 'list']);
85 Route::post('image-gallery', [ImageGalleryApiController::class, 'create']);
86 Route::get('image-gallery/url/data', [ImageGalleryApiController::class, 'readDataForUrl']);
87 Route::get('image-gallery/{id}', [ImageGalleryApiController::class, 'read']);
88 Route::get('image-gallery/{id}/data', [ImageGalleryApiController::class, 'readData']);
89 Route::put('image-gallery/{id}', [ImageGalleryApiController::class, 'update']);
90 Route::delete('image-gallery/{id}', [ImageGalleryApiController::class, 'delete']);
92 Route::get('imports', [ExportControllers\ImportApiController::class, 'list']);
93 Route::post('imports', [ExportControllers\ImportApiController::class, 'create']);
94 Route::get('imports/{id}', [ExportControllers\ImportApiController::class, 'read']);
95 Route::post('imports/{id}', [ExportControllers\ImportApiController::class, 'run']);
96 Route::delete('imports/{id}', [ExportControllers\ImportApiController::class, 'delete']);
98 Route::get('recycle-bin', [EntityControllers\RecycleBinApiController::class, 'list']);
99 Route::put('recycle-bin/{deletionId}', [EntityControllers\RecycleBinApiController::class, 'restore']);
100 Route::delete('recycle-bin/{deletionId}', [EntityControllers\RecycleBinApiController::class, 'destroy']);
102 Route::get('roles', [RoleApiController::class, 'list']);
103 Route::post('roles', [RoleApiController::class, 'create']);
104 Route::get('roles/{id}', [RoleApiController::class, 'read']);
105 Route::put('roles/{id}', [RoleApiController::class, 'update']);
106 Route::delete('roles/{id}', [RoleApiController::class, 'delete']);
108 Route::get('search', [SearchApiController::class, 'all']);
110 Route::get('system', [SystemApiController::class, 'read']);
112 Route::get('users', [UserApiController::class, 'list']);
113 Route::post('users', [UserApiController::class, 'create']);
114 Route::get('users/{id}', [UserApiController::class, 'read']);
115 Route::put('users/{id}', [UserApiController::class, 'update']);
116 Route::delete('users/{id}', [UserApiController::class, 'delete']);