JSON data source

The JSON data source provides information about what REST client, REST call and path expressions to use.

The JSON data source is part of the magnolia-rest-client-ui extension module for the Magnolia 6 UI framework. The fully qualified class name is info.magnolia.rest.ui.JsonDatasourceDefinition.

If you work with the Magnolia 5 UI framework, see Content connector instead.

The JSON data source, which provides the ability to use REST clients in the UI, is a DX Core feature that is not available in the Community Edition.

Example definition

datasource:
  name: rest
  $type: jsonDatasource
  restClient: countries
  restCall: allCountries
  jsonPathExpressions:
    itemId: '$.name'
    items: '$.*'
    describeBy: '$.name'

List of properties

Property Description

class or $type

required

Use info.magnolia.rest.ui.JsonDatasourceDefinition for the class property or jsonDatasource for the $type shortcut.

restClient

required

Specifies the REST client to be used.

restCall

required

REST call configuration. Must use the entity class com.fasterxml.jackson.databind.JsonNode.

jsonPathExpressions

required

Simplifies data selection from REST responses. See info.magnolia.rest.ui.JsonPathExpressionsDefinition for more information.

     itemId

required

Unique identifier of the item.

     items

required

List of items to be used by the data provider.

     describeBy

optional

Describes (in the status bar) the selected item.

     preview

optional

Provides preview of the selected item.

     properties

optional

Mapping to get values using path expressions. Useful for values deep in the hierarchy.

name

optional, default is rest

Name of the data source.

pagination

optional

Defines a pagination strategy for the list presenter. Must implement the info.magnolia.rest.ui.pagination.PaginationStrategyDefinition interface.

When the JSON data source is paginated, sorting is disabled for lists and the items appear in the order delivered by the REST API.

Data source components

Module component mappings can be defined in the context of the current data source (a component section should have an id in the form of <id>datasource-<ds-name></id>, where <ds-name> is configured in the definition).

Type Implementation Description

info.magnolia.rest.ui.RestClientInvoker

info.magnolia.rest.ui.RestClientInvoker

Helper class for making calls to REST clients.

info.magnolia.rest.ui.JsonDataProvider

info.magnolia.rest.ui.JsonDataProvider

Data provider implementation using REST client.

info.magnolia.ui.datasource.ItemResolver

info.magnolia.rest.ui.JsonItemResolver

Converts path to actual item and back.

info.magnolia.ui.contentapp.browser.preview.PreviewProvider

info.magnolia.rest.ui.preview.JsonPreviewProvider

Provides preview of selected item (for example, content of a binary node or link to an image).

info.magnolia.ui.datasource.PropertySetFactory

info.magnolia.rest.ui.JsonPropertySetFactory

Reads and writes properties from/to item in form.

info.magnolia.ui.field.SelectFieldSupport

info.magnolia.rest.ui.JsonSelectFieldSupport

Provides delegates required by select fields.

info.magnolia.rest.ui.HealthCheck

info.magnolia.rest.ui.HealthCheck

Checks whether the REST call is available.

info.magnolia.rest.ui.field.factory.JsonLinkFieldFactory

info.magnolia.rest.ui.field.factory.JsonLinkFieldFactory

Factory class that creates/initializes info.magnolia.rest.ui.field.linkfield.JsonLinkFieldDefinition.

info.magnolia.rest.ui.field.factory.JsonComboBoxFieldFactory

info.magnolia.rest.ui.field.factory.JsonComboBoxFieldFactory

Factory class that creates/initializes info.magnolia.rest.ui.field.comboboxfield.JsonComboBoxFieldDefinition.

info.magnolia.ui.contentapp.browser.StatusBar

info.magnolia.rest.ui.JsonStatusBar

Displays description for selected item(s) at the bottom of app.

info.magnolia.ui.contentapp.browser.ListPresenter

info.magnolia.rest.ui.JsonListPresenter

Displays items as list.

Component mappings in module descriptor
<components>
  <id>datasource-rest</id>
  <component>
    <type>info.magnolia.rest.ui.RestClientInvoker</type>
    <implementation>info.magnolia.rest.ui.RestClientInvoker</implementation>
    <scope>singleton</scope>
  </component>
  <component>
    <type>info.magnolia.rest.ui.JsonDataProvider</type>
    <implementation>info.magnolia.rest.ui.JsonDataProvider</implementation>
  </component>
  <component>
    <type>info.magnolia.ui.datasource.ItemResolver</type>
    <implementation>info.magnolia.rest.ui.JsonItemResolver</implementation>
  </component>
  <component>
    <type>info.magnolia.ui.contentapp.browser.preview.PreviewProvider</type>
    <implementation>info.magnolia.rest.ui.preview.JsonPreviewProvider</implementation>
  </component>
  <component>
    <type>info.magnolia.ui.datasource.PropertySetFactory</type>
    <implementation>info.magnolia.rest.ui.JsonPropertySetFactory</implementation>
  </component>
  <component>
    <type>info.magnolia.ui.field.SelectFieldSupport</type>
    <implementation>info.magnolia.rest.ui.JsonSelectFieldSupport</implementation>
  </component>
  <component>
    <type>info.magnolia.rest.ui.HealthCheck</type>
    <implementation>info.magnolia.rest.ui.HealthCheck</implementation>
  </component>
  <type-mapping>
    <type>info.magnolia.rest.ui.field.factory.JsonLinkFieldFactory</type>
    <implementation>info.magnolia.rest.ui.field.factory.JsonLinkFieldFactory</implementation>
  </type-mapping>
  <type-mapping>
    <type>info.magnolia.rest.ui.field.factory.JsonComboBoxFieldFactory</type>
    <implementation>info.magnolia.rest.ui.field.factory.JsonComboBoxFieldFactory</implementation>
  </type-mapping>
  <type-mapping>
    <type>info.magnolia.ui.contentapp.browser.StatusBar</type>
    <implementation>info.magnolia.rest.ui.JsonStatusBar</implementation>
  </type-mapping>
  <type-mapping>
    <type>info.magnolia.ui.contentapp.browser.ListPresenter</type>
    <implementation>info.magnolia.rest.ui.JsonListPresenter</implementation>
  </type-mapping>
</components>
Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules