Curl command to list nodes | Community
Skip to main content
Level 4
Apr 18, 2023 11:44 AM UTC
Solved

Curl command to list nodes

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
somen-sarkar
somen-sarkarAccepted solution
New Participant
Apr 18, 2023 1:50 PM UTC

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.limit=-1'

 

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

 

Thanks,

Somen

3 replies

Siva_Sogalapalli
New Participant
Apr 18, 2023 2:22 PM UTC

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. 

 

Translate
somen-sarkar
somen-sarkarAccepted solution
New Participant
Apr 18, 2023 1:50 PM UTC

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.limit=-1'

 

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

 

Thanks,

Somen

Translate
arunpatidar
New Participant
Apr 18, 2023 12:30 PM UTC

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.

Translate
Arun Patidar