Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Curl command to list nodes

Avatar

Level 4

Been to the curl example pages, but haven't found what I am looking for.

I want a curl command that will list all the nodes and child nodes under a specific node.

Anyone know of a curl command like this?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi,

Tried below curl command to get all the child pages under '/content/wknd/ca/en' . Hopefully you may modify the same  depending on your need .

 

curl -u admin:admin --location --request POST 'http://localhost:4502/bin/querybuilder.json?type=cq:Page&path=/content/wknd/ca/en&path.flat=true&p.l...'

 

Query builder cheat sheet :- https://github.com/paulrohrbeck/aem-links/blob/master/querybuilder_cheatsheet.md

 

Thanks,

Somen

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @Tom_Fought 

I don't think so there is dedicated API to list nodes except infinity.json API

you can use infinity.json if that works in your case.



Arun Patidar

Avatar

Correct answer by
Level 7

Hi,

Tried below curl command to get all the child pages under '/content/wknd/ca/en' . Hopefully you may modify the same  depending on your need .

 

curl -u admin:admin --location --request POST 'http://localhost:4502/bin/querybuilder.json?type=cq:Page&path=/content/wknd/ca/en&path.flat=true&p.l...'

 

Query builder cheat sheet :- https://github.com/paulrohrbeck/aem-links/blob/master/querybuilder_cheatsheet.md

 

Thanks,

Somen

Avatar

Community Advisor

Query builder will help to search for any specific node type but if you want to list all nodes then pagepath.infinity.json is one option. Alternatively, if you wan to narrow down the results with specific levels then you can also try with pagepath.<0-n>.json 

Example: 

http://localhost:4502/content/we-retail/us/en/experience.infinity.json  - This results entire json with all the nodes details.

http://localhost:4502//content/we-retail/us/en/experience.1.json - this results only one level of node info. So, you can replace the number if you know the depths or nodes.