Repository navigation
JSPWIKI-1310 Add reading of pages, their history and their attachments to the REST API - #645
Draft
arturobernalg wants to merge 23 commits into
Draft
arturobernalg wants to merge 23 commits into
arturobernalg wants to merge 23 commits into
Conversation
…n OpenAPI file that a test compares with the answers
… the REST API version 1
# Conflicts: # ChangeLog.md
…o feature/JSPWIKI-1310-plugins-suggestions # Conflicts: # ChangeLog.md
…310-plugins-suggestions
…310-search # Conflicts: # ChangeLog.md
…310-plugins-suggestions # Conflicts: # ChangeLog.md
…s to the REST API version 1
…310-search # Conflicts: # ChangeLog.md
…o feature/JSPWIKI-1310-plugins-suggestions # Conflicts: # ChangeLog.md # jspwiki-main/src/main/java/org/apache/wiki/search/DefaultSearchManager.java
…gestions' into feature/JSPWIKI-1310-pages-read
…the pages in the REST API
…t do not wait for it
…o feature/JSPWIKI-1310-plugins-suggestions
…gestions' into feature/JSPWIKI-1310-pages-read
…o feature/JSPWIKI-1310-plugins-suggestions
…gestions' into feature/JSPWIKI-1310-pages-read # Conflicts: # ChangeLog.md
This was referenced Nov 20, 2026
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of JSPWIKI-1310. This pull request builds on #589 and #590, so it shows their commits until they are merged; the new commit is the last one.
Adds three read-only endpoints to the REST API version 1, all described in
openapi.yaml:GET /api/v1/pages/{name}: name, version, author, last modified and the wiki markup of the page. The optional parameterversionasks for an older version.GET /api/v1/pages/{name}/history: the versions of the page, latest first.GET /api/v1/pages/{name}/attachments: the attachments of the page, sorted by name, with size and version.The caller needs the view permission on the page: 401 for an anonymous caller, 403 for a logged in one. The permission is checked before the existence of the page, so the answer does not tell whether a page is there. A page that does not exist is 404 and a
versionthat is not a positive integer is 400.Two details worth a look. A provider that keeps no old versions numbers its only version -1, which the API reports as 1. A page that was put in the page directory by hand has no history, and its history lists the current version.
There is no writing in this pull request on purpose. Creating, editing and deleting need decisions about CSRF and ACLs that I would like to discuss first.
Tested with
ApiV1ServletTest, 32 tests, each answer compared withopenapi.yaml. Also run on a war in Tomcat 10.1: page, unknown page, page with an ACL (401),version=0(400), history and attachments. Not tried: a logged in caller on the running wiki (covered only by the test), and attachments with a provider other than the default.