REST endpoints for the Image Style Application

Last modified by Admin on 2024/10/28 17:47

cogREST endpoints to get defined image styles
TypeJAR
CategoryAPI
Developed by

XWiki Development Team

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Compatibility

14.3RC1+

Installable with the Extension Manager

Description

This module provide the rest endpoints for the Image Style extension.

The datastructures used in the parameters and responses are defined in the Image Style Model.

Endpoints

GET /wikis/{wikiName}/imageStyles

Return the list of image styles of the given wiki, as well as their configurations.

For instance curl -XGET -H 'Accept: application/json' "http://localhost:8080/xwiki/rest/wikis/xwiki/imageStyles/" returns the following json:

{
 "imageStyles": [{
     "identifier": "teststyle",
     "prettyName": "Test Style",
     "type": "test-style",
     "adjustableSize": false,
     "defaultWidth": null,
     "defaultHeight": null,
     "adjustableBorder": false,
     "defaultBorder": false,
     "adjustableAlignment": false,
     "defaultAlignment": "none",
     "adjustableTextWrap": false,
     "defaultTextWrap": false
    },
    {
     "identifier": "style2",
     "prettyName": "Style 2",
     "type": "style-2",
     "adjustableSize": false,
     "defaultWidth": null,
     "defaultHeight": 100,
     "adjustableBorder": true,
     "defaultBorder": false,
     "adjustableAlignment": false,
     "defaultAlignment": "none",
     "adjustableTextWrap": false,
     "defaultTextWrap": false
    }
  ]
}

GET /wikis/{wikiName}/imageStyles/default

Return the default image style of a given wiki.

For instance curl -XGET -H 'Accept: application/json' "http://localhost:8080/xwiki/rest/wikis/xwiki/imageStyles/default" returns the following json:

{
 "defaultStyle": "teststyle"
}

When no default style is configured, and empty object {} is returned.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Dependencies

Dependencies for this extension (org.xwiki.platform:xwiki-platform-image-style-rest 16.9.0):

Get Connected