[MGNLREST-173] Get ordered tree of content from configured root of endpoint Created: 28/Feb/18 Updated: 04/May/18 Resolved: 26/Apr/18 |
|
| Status: | Closed |
| Project: | Magnolia REST Framework |
| Component/s: | None |
| Affects Version/s: | 2.0.2 |
| Fix Version/s: | 2.1.1 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Christopher Zimmermann | Assignee: | Oanh Thai Hoang |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | 3h | ||
| Time Spent: | 5.75d | ||
| Original Estimate: | 4d | ||
| Issue Links: |
|
||||||||||||||||||||
| Template: |
|
||||||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||||||||||
| Release notes required: |
Yes
|
||||||||||||||||||||
| Documentation update required: |
Yes
|
||||||||||||||||||||
| Date of First Response: | |||||||||||||||||||||
| Sprint: | Saigon 141, Saigon 142, Saigon 143, Saigon 144 | ||||||||||||||||||||
| Story Points: | 5 | ||||||||||||||||||||
| Description |
|
From a configured delivery endpoint it should be possible to get the ordered tree of content directly "under" the configured root node. It should be possible to get items at the root level with their "natural order" preserved. The QueryNode behaviour does not return the ordered tree. The ReadNode behaviour does, but cannot be used on the configured root of the endpoint. This should work for any configured root - and of course should work if the configured root is the actual root of the repository.
One idea could be to add a parameter which forces the ReadNode behaviour to be returned starting at the configured root - but only returns the nodes of the root element, not its properties. Another idea would be to eventually make the ReadNode behaviour the default when requesting an endpoint without any path or querystring. |
| Comments |
| Comment by Christopher Zimmermann [ 27/Mar/18 ] |
|
A developer should not have to configure somethjing special on the endpoint - but anyway I did this experiement of "rep:root" nodetype: Interesting if I try this config: class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition workspace: website rootPath: / endpointPath: /delivery/ep1 includeSystemProperties: false depth: 2 nodeTypes: - rep:root childNodeTypes: - mgnl:page Then when I try to access the endpoint with no parameters: http://localhost:8080/magnoliaAuthor/.rest/delivery/ep1/ I get the root and i get the "travel" page with children. |
| Comment by Christopher Zimmermann [ 03/Apr/18 ] |
|
hieu.nguyen What syntax is used to get the ordered tree starting at the configured root? |
| Comment by Hieu Nguyen Duc [ 03/Apr/18 ] |
|
czimmermann We're implementing a way to do that. @devs: FYI JAX-RS's URI rule doesn't differentiate between cases with "/" and without "/". https://stackoverflow.com/questions/15196698/rest-resteasy-cutting-trailing-slash-off-path |
| Comment by Oanh Thai Hoang [ 03/Apr/18 ] |
|
Hi czimmermann, We are considering below syntax to serve for root case
Note: @root: May misunderstood with jcr property query |
| Comment by Mikaël Geljić [ 03/Apr/18 ] |
|
I'd go for `@root`, we're consistantly using the `@` char wherever we need to disambiguate special properties & handles (e.g. `@ancestor` too); with the only difference here being that it's not a filter/param. I expect the JAX-RS request matching to be smart enough to resolve a potential 3rd method-endpoint serving that. |
| Comment by Mikaël Geljić [ 05/Apr/18 ] |
** /users/ -> read (“/“) ** /users/? -> query(“”) I'm not sure you can distinguish the matched endpoint based on presence/absence of query params; and even if you could, that would be confusing because it's no longer the same "resource". See also: |
| Comment by Hieu Nguyen Duc [ 26/Apr/18 ] |
Updates for documentationNow you can get a list of pages under root path, which maintains "natural order". class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition workspace: website depth: 1 bypassWorkspaceAcls: true includeSystemProperties: false childNodeTypes: - mgnl:page Request
curl --request GET --url http://<host>/.rest/<endpointPath>/@nodes
Response
[
{
"@name": "travel",
"@path": "/travel",
"@id": "b06b82a2-74b0-4994-8015-028c4fd60716",
"@nodeType": "mgnl:page",
"hideInNav": "false",
"description": "Magnolia Travels is a demonstration project for Magnolia CMS. Browse the site to get an overview of Magnolia CMS features, and learn how to edit the content online. Or download the project and dig into the sources to learn the key templating features of Magnolia CMS.",
"searchResultPage": "6df1ebd8-fc9d-4db3-8539-02829c56b9f2",
"title": "Travel Home",
"keywords": "Magnolia CMS, Open Source CMS, Content management, Demonstration project, Demo project, Demo, Online demo, Website builder",
"tour-type": { ... },
"destination": { ... },
"tour": { ... },
"stories": { ... },
"about": { ... },
"contact": { ... },
"meta": { ... },
"book-tour": { ... },
"members": { ... },
"tour-finder": { ... },
"tour-tag": { ... },
"@nodes": [
"tour-type",
"destination",
"tour",
"stories",
"about",
"contact",
"meta",
"book-tour",
"members",
"tour-finder",
"tour-tag"
]
},
{
"@name": "sportstation",
"@path": "/sportstation",
"@id": "5f26a93e-9d21-4231-9e60-c8edbb0d339d",
"@nodeType": "mgnl:page",
"hideInNav": "false",
"description": "Magnolia Travels is a demonstration project for Magnolia CMS. Browse the site to get an overview of Magnolia CMS features, and learn how to edit the content online. Or download the project and dig into the sources to learn the key templating features of Magnolia CMS.",
"title": "Sportstation",
"keywords": "Magnolia CMS, Open Source CMS, Content management, Demonstration project, Demo project, Demo, Online demo, Website builder",
"about": { ... },
"tour": { ... },
"@nodes": [
"about",
"tour"
]
}
]
Refer to README for more details. |