[DOCU-1349] How to get items in natural order with the REST delivery endpoint Created: 28/Feb/18  Updated: 16/May/18  Resolved: 16/May/18

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Neutral
Reporter: Christopher Zimmermann Assignee: Martin Drápela
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: JPEG File requests-and-the-order-of-their-nodes-in-response.JPG     PNG File requests-and-the-order-of-their-nodes-in-response_edited.png    
Issue Links:
relation
is related to MGNLREST-169 By default, items should have order t... Closed
is related to MGNLREST-173 Get ordered tree of content from conf... Closed
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Documentation update required:
Yes
Date of First Response:
Sprint: Docu Sprint 48, Docu Sprint 49, Docu Sprint 50
Story Points: 0.5

 Description   

The only way to definitely get items in natural order is to use a "readNode" to get a parent item and all the children will be listed in natural order. This should be clearly documented.

It should also be documented that if you supply no parameters or path - then the QUERY is used, not the READNODE.

It should be documented that when the QUERY is used with no ordering paramaters - than the "nagtural" repositories order will be used. But that this unfortunately often does not reflect the order in the app. There should be some information about JCR indexing etc. See forum posts linked here: https://jira.magnolia-cms.com/browse/MGNLREST-169?focusedCommentId=156550&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-156550

 

 


It might be possible to do this on items in the root by requesting the root node - but im not sure.

After a ticket is fixed it may be possible to get items from the "query" but it depends on a bug being fixed and on strange JCR behaviour as mentioned in linked ticket.

See comments on: https://jira.magnolia-cms.com/browse/MGNLREST-169



 Comments   
Comment by Christopher Zimmermann [ 28/Feb/18 ]

Note that there is an existing limitation i that you (apparently) can not get readNode from the ROOT: MGNLREST-173

Comment by Christoph Meier [ 14/May/18 ]

mdrapela - I have reviewd.
I was adding one sentence somewhere (you will be notified by wiki mail).

Note the following:
The related dev tickets REST-173 and REST-186 have been released with rest-2.1.1 - hence the first bundle getting it was 5.6.6 (not 5.6.5)
So ... the mentioned Magnolia versions at the orderBy param must be changed, I guess. See:

I anyway could not completely follow your text

"Please note that until Magnolia 5.6.5 ..."
"Since Magnolia 5.6.5 the results are returned unsorted if no ..."

I am still not sure about the order when using no query params, no path and not using @nodes . I was asking dai.ha and he checks for me with the VN Core team. (He also was not fully sure at first sight).

 

 

 

Comment by Christoph Meier [ 14/May/18 ]

After having discussed the whoe thing with hieu.nguyen -I have realized, that we actually have no 3 "sub resources"

  • readNode
  • queryNodes
  • getChildren

There is indeed a new public method. In docs we mention this as the @nodes handle.
Hieu and me, we think we should change the docs, and mention the "@nodes" handle

  • either as a 3rd mentioned sub resource
  • or within the readNode section.

And we should clarify the point concerning how things are ordered, of no orderBy param is used.
The following requests would respond with "naturally" ordered nodes:

  • /.rest/ep/
  • /.rest/ep/@nodes
  • /.rest/ep/travel/@nodes

But the request
/.rest/ep/travel
not!

Comment by Hieu Nguyen Duc [ 14/May/18 ]

cmeier Sorry, I meant readNode has no order for properties because they are written manually. For child nodes, they're returned in natural order.

Comment by Christopher Zimmermann [ 14/May/18 ]

"Get children" basically means using the "@nodes" handle right? 

If so, wouldnt it make sense to include that as a part of "Read node" or directly underneath it, since it behaves almost the same as "Read node"? - Its kind of a special way to use "Read node".

Generated at Mon Feb 12 01:17:21 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.