Include optional HTML rendering to pages REST endpoint

Last modified by Pierre Jeanjean on 2026/03/23 17:05

Description

Requirements

  • Provide a displayable version of a page for clients that do not support the page's syntax
  • Make it optional

Definition

Endpoints

These are existing endpoints, where the only change is the addition of a query parameter to add this feature (in bold).

/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}[?prettyNames={true,false}&objects={true,false}&class={true,false}&attachments={true,false}&minorRevision={true,false}[&checkRight={rightName}]*][&supportedSyntax={syntaxId}]*]

  • HTTP Method: GET
    • Media types:
      • application/xml (Page element)
    • Query parameters
      • prettyNames: also return the pretty name for various document information (like the author display name, etc). Disabled by default.
      • objects: [since 7.3M1] also return the objects. Disabled by default.
      • class: [since 7.3M1] also return the class. Disabled by default.
      • attachments: [since 7.3M1] also return the attachments metadatas. Disabled by default.
      • checkRight: also return whether the user has the right {rightName} on the page. Multiple checks can be requested. Empty by default.
      • supportedSyntax: if set and the pages's syntax is not in the list, also return an HTML rendering of the page. Empty by default.
    • Description: 
    • Status codes:
      • 200: If the request was successful.
      • 401: If the user is not authorized.

Examples

A client that only support parsing and displaying pages in markdown 1.2 could fetch the home page like this:

GET /wikis/xwiki/spaces/Main/pages/WebHome?supportedSyntax=markdown%2F1.2

If the fetched page uses a different syntax (e.g., xwiki/2.1), the response would also include:

<renderedContent><!-- HTML rendered version of content. --></renderedContent>

 


Get Connected