[MGNLREST-102] Implement sorting for listing endpoints Created: 21/Apr/17  Updated: 21/Sep/17  Resolved: 21/Sep/17

Status: Closed
Project: Magnolia REST Framework
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Neutral
Reporter: Mikaël Geljić Assignee: Dai Ha
Resolution: Done Votes: 0
Labels: jcr, rest
Remaining Estimate: 2d
Time Spent: 1d
Original Estimate: 3d

Template:
Acceptance criteria:
Empty
Date of First Response:
Epic Link: REST Queries
Sprint: Saigon 113, Saigon 114
Story Points: 3

 Description   
  • most likely via query-params


 Comments   
Comment by Dai Ha [ 21/Sep/17 ]

The required function is already support in scope of MGNLREST-102.
In order to sort listing result, user needs to apply query param orderBy as described in:

https://wiki.magnolia-cms.com/display/VN/Content+Delivery+Endpoint

Quick summary:

  • Allow to sort listing result by entry's property value.
  • Able to handle multiple sorting conditions on multiple properties.
  • Support Ascending and/or Descending sorting.

Sample query:
http://<host>/.rest/delivery/<workspace>/v1/?orderBy=mgnl:lastModified desc,mgnl:lastModified asc

Open point: as I see, Jira simplifies query-params as follow:
http://<host>/.rest/delivery/<workspace>/v1/?orderBy=-mgnl:lastModified,+mgnl:lastModified

mgeljic, would this applicable for our endpoints?

Comment by Mikaël Geljić [ 21/Sep/17 ]

Thanks dai.ha for the update

I personally find asc/desc more explicit than +/-, but we will probably need similar "operators" for filtering
Also, what is the default direction if not specified? everything is ascending? we could also make dates descending by default.

—In other words, let's close it as "Done"; we can add the syntax sugar later.

Generated at Mon Feb 12 06:56:37 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.