Getting AEM Child nodes through external javascript

Multi tool use
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am creating a React application that needs to inherit a secondary nav specific to each product in the AEM CMS.
Let assume we have pages in CMS laid out something like this:
- Product 1
-- Child Page 1A
-- Child Page 1B
-- Child Page 1C
- Product 2
-- Child Page 2A
-- Child Page 2B
-- Child Page 2C
Now, in the external app if someone is loading the Product 1, I would like to query AEM to get the children nodes for Product 1.
Is this even possible? If yes, how can go about it? I don't know if there is an AEM API that I can tap into or can I use a sling/selector combination to get the children nodes? Any help would be appreciated.
Thanks
javascript aem cq5
add a comment |
I am creating a React application that needs to inherit a secondary nav specific to each product in the AEM CMS.
Let assume we have pages in CMS laid out something like this:
- Product 1
-- Child Page 1A
-- Child Page 1B
-- Child Page 1C
- Product 2
-- Child Page 2A
-- Child Page 2B
-- Child Page 2C
Now, in the external app if someone is loading the Product 1, I would like to query AEM to get the children nodes for Product 1.
Is this even possible? If yes, how can go about it? I don't know if there is an AEM API that I can tap into or can I use a sling/selector combination to get the children nodes? Any help would be appreciated.
Thanks
javascript aem cq5
helpx.adobe.com/experience-manager/6-3/sites/developing/using/… ?
– azium
Jan 3 at 22:07
add a comment |
I am creating a React application that needs to inherit a secondary nav specific to each product in the AEM CMS.
Let assume we have pages in CMS laid out something like this:
- Product 1
-- Child Page 1A
-- Child Page 1B
-- Child Page 1C
- Product 2
-- Child Page 2A
-- Child Page 2B
-- Child Page 2C
Now, in the external app if someone is loading the Product 1, I would like to query AEM to get the children nodes for Product 1.
Is this even possible? If yes, how can go about it? I don't know if there is an AEM API that I can tap into or can I use a sling/selector combination to get the children nodes? Any help would be appreciated.
Thanks
javascript aem cq5
I am creating a React application that needs to inherit a secondary nav specific to each product in the AEM CMS.
Let assume we have pages in CMS laid out something like this:
- Product 1
-- Child Page 1A
-- Child Page 1B
-- Child Page 1C
- Product 2
-- Child Page 2A
-- Child Page 2B
-- Child Page 2C
Now, in the external app if someone is loading the Product 1, I would like to query AEM to get the children nodes for Product 1.
Is this even possible? If yes, how can go about it? I don't know if there is an AEM API that I can tap into or can I use a sling/selector combination to get the children nodes? Any help would be appreciated.
Thanks
javascript aem cq5
javascript aem cq5
asked Jan 3 at 21:44


BlueboyeBlueboye
4271128
4271128
helpx.adobe.com/experience-manager/6-3/sites/developing/using/… ?
– azium
Jan 3 at 22:07
add a comment |
helpx.adobe.com/experience-manager/6-3/sites/developing/using/… ?
– azium
Jan 3 at 22:07
helpx.adobe.com/experience-manager/6-3/sites/developing/using/… ?
– azium
Jan 3 at 22:07
helpx.adobe.com/experience-manager/6-3/sites/developing/using/… ?
– azium
Jan 3 at 22:07
add a comment |
1 Answer
1
active
oldest
votes
You can get the child nodes of a Page doing a GET request with the required deep level and the "json" extension.
For example, if you hit this:
.../Product1.1.json
The JSON result will be something like this:
{
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin",
"jcr:content": {
"jcr:primaryType": "cq:PageContent",
"jcr:createdBy": "admin",
"jcr:title": "Product1",
"cq:template": "X",
"sling:resourceType": "Y",
"cq:lastModifiedBy": "admin"
},
"child-page-1A": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
},
"child-page-1B": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
},
"child-page-1C": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
}
}
If you increase the deep level from 1 to X you can get more information from the child nodes/pages.
Sling Default JSON Rendering
As Florian Salihovic pointed out, the Default Renders may be disabled in a Production/Publish enviroment.
In this case you can implement a similar functionality with a Custom Servlet.
Thanks. This worked for me :).
– Blueboye
Jan 4 at 16:09
1
Might not work on the publisher - or might be blocked on the dispatcher / CDN level on production instances. Usually the renderers are disabled in production.
– Florian Salihovic
Jan 4 at 19:42
You are right. I'll add that to my answer, thanks!
– Evaristo Carmona
Jan 8 at 9:08
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54030224%2fgetting-aem-child-nodes-through-external-javascript%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can get the child nodes of a Page doing a GET request with the required deep level and the "json" extension.
For example, if you hit this:
.../Product1.1.json
The JSON result will be something like this:
{
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin",
"jcr:content": {
"jcr:primaryType": "cq:PageContent",
"jcr:createdBy": "admin",
"jcr:title": "Product1",
"cq:template": "X",
"sling:resourceType": "Y",
"cq:lastModifiedBy": "admin"
},
"child-page-1A": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
},
"child-page-1B": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
},
"child-page-1C": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
}
}
If you increase the deep level from 1 to X you can get more information from the child nodes/pages.
Sling Default JSON Rendering
As Florian Salihovic pointed out, the Default Renders may be disabled in a Production/Publish enviroment.
In this case you can implement a similar functionality with a Custom Servlet.
Thanks. This worked for me :).
– Blueboye
Jan 4 at 16:09
1
Might not work on the publisher - or might be blocked on the dispatcher / CDN level on production instances. Usually the renderers are disabled in production.
– Florian Salihovic
Jan 4 at 19:42
You are right. I'll add that to my answer, thanks!
– Evaristo Carmona
Jan 8 at 9:08
add a comment |
You can get the child nodes of a Page doing a GET request with the required deep level and the "json" extension.
For example, if you hit this:
.../Product1.1.json
The JSON result will be something like this:
{
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin",
"jcr:content": {
"jcr:primaryType": "cq:PageContent",
"jcr:createdBy": "admin",
"jcr:title": "Product1",
"cq:template": "X",
"sling:resourceType": "Y",
"cq:lastModifiedBy": "admin"
},
"child-page-1A": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
},
"child-page-1B": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
},
"child-page-1C": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
}
}
If you increase the deep level from 1 to X you can get more information from the child nodes/pages.
Sling Default JSON Rendering
As Florian Salihovic pointed out, the Default Renders may be disabled in a Production/Publish enviroment.
In this case you can implement a similar functionality with a Custom Servlet.
Thanks. This worked for me :).
– Blueboye
Jan 4 at 16:09
1
Might not work on the publisher - or might be blocked on the dispatcher / CDN level on production instances. Usually the renderers are disabled in production.
– Florian Salihovic
Jan 4 at 19:42
You are right. I'll add that to my answer, thanks!
– Evaristo Carmona
Jan 8 at 9:08
add a comment |
You can get the child nodes of a Page doing a GET request with the required deep level and the "json" extension.
For example, if you hit this:
.../Product1.1.json
The JSON result will be something like this:
{
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin",
"jcr:content": {
"jcr:primaryType": "cq:PageContent",
"jcr:createdBy": "admin",
"jcr:title": "Product1",
"cq:template": "X",
"sling:resourceType": "Y",
"cq:lastModifiedBy": "admin"
},
"child-page-1A": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
},
"child-page-1B": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
},
"child-page-1C": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
}
}
If you increase the deep level from 1 to X you can get more information from the child nodes/pages.
Sling Default JSON Rendering
As Florian Salihovic pointed out, the Default Renders may be disabled in a Production/Publish enviroment.
In this case you can implement a similar functionality with a Custom Servlet.
You can get the child nodes of a Page doing a GET request with the required deep level and the "json" extension.
For example, if you hit this:
.../Product1.1.json
The JSON result will be something like this:
{
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin",
"jcr:content": {
"jcr:primaryType": "cq:PageContent",
"jcr:createdBy": "admin",
"jcr:title": "Product1",
"cq:template": "X",
"sling:resourceType": "Y",
"cq:lastModifiedBy": "admin"
},
"child-page-1A": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
},
"child-page-1B": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
},
"child-page-1C": {
"jcr:primaryType": "cq:Page",
"jcr:createdBy": "admin"
}
}
If you increase the deep level from 1 to X you can get more information from the child nodes/pages.
Sling Default JSON Rendering
As Florian Salihovic pointed out, the Default Renders may be disabled in a Production/Publish enviroment.
In this case you can implement a similar functionality with a Custom Servlet.
edited Jan 8 at 9:13
answered Jan 4 at 7:39
Evaristo CarmonaEvaristo Carmona
15110
15110
Thanks. This worked for me :).
– Blueboye
Jan 4 at 16:09
1
Might not work on the publisher - or might be blocked on the dispatcher / CDN level on production instances. Usually the renderers are disabled in production.
– Florian Salihovic
Jan 4 at 19:42
You are right. I'll add that to my answer, thanks!
– Evaristo Carmona
Jan 8 at 9:08
add a comment |
Thanks. This worked for me :).
– Blueboye
Jan 4 at 16:09
1
Might not work on the publisher - or might be blocked on the dispatcher / CDN level on production instances. Usually the renderers are disabled in production.
– Florian Salihovic
Jan 4 at 19:42
You are right. I'll add that to my answer, thanks!
– Evaristo Carmona
Jan 8 at 9:08
Thanks. This worked for me :).
– Blueboye
Jan 4 at 16:09
Thanks. This worked for me :).
– Blueboye
Jan 4 at 16:09
1
1
Might not work on the publisher - or might be blocked on the dispatcher / CDN level on production instances. Usually the renderers are disabled in production.
– Florian Salihovic
Jan 4 at 19:42
Might not work on the publisher - or might be blocked on the dispatcher / CDN level on production instances. Usually the renderers are disabled in production.
– Florian Salihovic
Jan 4 at 19:42
You are right. I'll add that to my answer, thanks!
– Evaristo Carmona
Jan 8 at 9:08
You are right. I'll add that to my answer, thanks!
– Evaristo Carmona
Jan 8 at 9:08
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54030224%2fgetting-aem-child-nodes-through-external-javascript%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
MJHxveb3Tb,umxjYOxFfbs,SG,XoLQEtVqR9yEuj2 KQat
helpx.adobe.com/experience-manager/6-3/sites/developing/using/… ?
– azium
Jan 3 at 22:07