Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page describes the delivery endpoint version 1 for obtaining JCR data as JSON. The endpoint provides two resources methods that can be called with HTTP 

Mgnl get
. You can only create a single configuration that is required to use it.

...

Table of Contents
maxLevel4
minLevel2
excludeParameters

Methods

Read node

Returns one node by a given path, including its properties and child nodes down to a certain depth.

Request URL

Mgnl get
 <magnolia-base-path>/.rest/delivery/{endpointPrefix}/v1/{path}

Parameters
Advanced Tables - Table Plus
highlightColor@default
multiplefalse
enableHeadingAttributesfalse
enableSortingfalse
enableHighlightingfalse

Parameter

Description

Data type

endpointPrefix

required

The name of an endpoint prefix as configured. May also be a real workspace name.

String

path

required

The path relative to the rootPath defined in the configuration.

String

Example

Get the node of the first component in the main area of the /travel/about page.

...

Expand
titleClick to see the resulting JSON
Code Pro
languagejs
{
  "@name": "00",
  "@path": "/travel/about/main/00",
  "@id": "01db6fc1-78af-4284-adf0-8c997309df6a",
  "@nodeType": "mgnl:component",
  "text": "<p>We are a full service, independent travel agency.</p>\n<p>We offer unique tours from every continent on the planet. Get inspired and book your tour with us for an experience you&rsquo;ll always remember.</p> ",
  "text_de": "<p>Wir sind eine unabh&auml;ngige Reiseagentur mit Rundumservice.</p>\n<p>Wir bieten einzigartige Reisen f&uuml;r jeden Kontinent der Erde an. Lassen Sie sich inspirieren und buchen Sie Ihre Reise bei uns, um Erfahrungen zu machen, die Ihnen f&uuml;r immer in Erinnerung bleiben werden.</p> ",
  "headline_de": "Über Magnolia Travels",
  "imagePosition": "below",
  "headlineLevel": "small",
  "headline": "About Magnolia Travels",
  "@nodes": []
}

This result is based on the basic configuration.

Query nodes

Returns a list of nodes matching a query composed of the query parameters provided. You can also apply filters to the query.

Request URL

Mgnl get
 <magnolia-base-path>/.rest/delivery/{endpointPrefix}/v1?param1=value1&param2=value2&... 

Use any of the optional query parameters or none.

Parameters
Advanced Tables - Table Plus
highlightColor@default
multiplefalse
enableHeadingAttributesfalse
enableSortingfalse
enableHighlightingfalse
(warning)

(info) Please note that until Magnolia 5.6.5 the results provided by the endpoint were sorted alphabetically on node names (same as with the ORDER BY LOWER(NAME(t)) statement in the JCR-SQL2 query) even though no orderBy parameter was set in the request URL.

Since Magnolia 5.6.5 the results are returned unsorted if no orderBy parameter is set. This however does not mean "in natural order" since many other aspects may be involved, such as the setting of the respectDocumentOrder property or index consistency. For more information, see Apache Jackrabbit Search and Rebuilding the Index.

Parameter

Description

Parameter type

Data type

endpointPrefix

required

The name of an endpoint prefix as configured. May also be a real workspace name.

path

String

q

optional

A search phrase (full-text search).

query

String

Anchor
anc-orderBy
anc-orderBy
orderBy

optional

The properties by which to order the nodes.

Example: mgnl:lastModified desc,title asc

Note that special characters such as a space (   ) must be encoded when sent in an HTTP request. When using tools to generate a REST request, this may happen automatically. With simple cURL you must encode it manually or with an additional tool.

Example: orderBy=title%20asc

Hide block

query

String

offset

optional, default is 0

The start position in a result list (for pagination).

queryInteger

limit

optional, default is as set in configuration

The number of nodes displayed in a page query. Use together with offset for pagination.

query

Integer

<filter>

optional

There are multiple filter options to filter for a property of the node, for node names, for nodes which must be ancestors of a given path, and so on. You can combine filters with an AND operator. See filter options.



Anchor
queryNodes-filter
queryNodes-filter
Filters

queryNodes provides a filtering mechanism. Filters are added as request parameters. Filter values must be properly URL-encoded. You can use multiple filters within the same request.

Filter format

The filter parameter has the following format: property[operator]=value

...

Code Block
https://example.com/.rest/delivery/pages/v1?title[like]=tour
Supported filter operators

Include Page
_filter operators
_filter operators

Filter types

Property filter

Filter for a node property. The property value must be an exact match.

Code Block
author=Magnolia%20Travels

@name property filter

Filter by a node name.

Code Block
@name=travel

@ancestor filter

Find nodes for which the path provided is the ancestor. The path must be absolute in the given workspace of the given workspace prefix.

Code Block
@ancestor=/travel/about/careers/marketing-associate
Usage notes
  • If no operator is provided, eq is used by default.

  • The value in the filter parameter is treated as String.

  • Use brackets to pass an operator, for example [eq][ne][lt], and so on.

  • For in and not-in, a range symbol ~ (the tilde) should be provided, for example:

    Code Block
    https://example.com/.rest/delivery/pages/v1?mgnl:created[in]=2018-01-01~2018-02-01
  • Ranges are inclusive: price[in]=100~200 is interpreted as price >= 100 AND price <= 200.
  • For filtering by date and time, only two ISO 8601-based formats are accepted. The patterns shown are in JAVA notation (java.text.SimpleDateFormat):
    • Date:  yyyy-MM-dd

      Code Block
      2018-01-01
    • Datetime:  yyyy-MM-dd'T'HH:mm:ss.SSSXXX

      Code Block
      2018-01-11T10:26:47.438+07:00
  • If a filter can take multiple possible values which must match, use | (OR):

    Code Block
    @name=travel|about

Anchor
example-queryNodes
example-queryNodes
Examples

Include Page
_REST delivery endpoint v1 filter examples
_REST delivery endpoint v1 filter examples

...