-
Improvement
-
Resolution: Unresolved
-
Neutral
-
None
-
2.2.4
-
None
-
None
Update
This is by design, but the design is admitteadly not what one expects.
You can acheive the expected using the @nodes directive. so for the following examples, use:
http://localhost:8080/magnoliaAuthor/.rest/customEndpoint/@nodes
When you supply no parameters, then the endpoint uses the "Query Nodes" method -this returns all nodes that are specified in the config, not just the children of the current path. Users often expect that it will use the "Read Node" method.
See the documentation for more details:
https://docs.magnolia-cms.com/product-docs/6.2/Developing/API/Delivery-API.html#_methods
KEEPING THIS TICKET As something to consider in a future version of the endpoint.
Steps to reproduce
- In a demo bundle, create a custom endpoint with following definition
class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition workspace: website includeSystemProperties: false depth: 0 nodeTypes: - mgnl:page childNodeTypes: - mgnl:page
- Call it without indicating the path, i.e. http://localhost:8080/magnoliaAuthor/.rest/customEndpoint/
- Call it indicating a path, e.g. http://localhost:8080/magnoliaAuthor/.rest/customEndpoint/travel
See good analysis in linked ticket:
https://jira.magnolia-cms.com/browse/MGNLREST-356
Expected results
Since depth is 0, we should only retrieve /travel and /sportstation pages
Actual results
We get 10 pages regardless the depth in they are located:
/sportstation/about
/sportstation
/sportstation/tour
/travel/book-tour
/travel/book-tour/meal
/travel/about/careers/customer-experience-agent
/travel/about/careers/marketing-associate
/travel/book-tour/review
/travel/meta/search-results
/travel/members
Workaround
Use @nodes parameter - see: https://docs.magnolia-cms.com/product-docs/6.2/Developing/API/Delivery-API.html#_methods
Development notes
The returned pages are the result of the execution of the following query in info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpoint.queryNodes(String, String, Long, Long) method:
SELECT t.* FROM [nt:base] AS t WHERE t.[jcr:primaryType] = 'mgnl:page'
When indicating a path, info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpoint.readNode(String) is executed instead which applies the depth value to the children of the given node as expected.
- is duplicated by
-
MGNLREST-356 Issue with depth definition parameter, when targetting a root node
- Closed