arturobernalg opened a new pull request, #645: URL: https://github.com/apache/jspwiki/pull/645
Part of [JSPWIKI-1310](https://issues.apache.org/jira/browse/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 parameter `version` asks 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 `version` that 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 with `openapi.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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
