Curl command to list nodes | Community
Skip to main content
Level 4
April 18, 2023
Solved

Curl command to list nodes

  • April 18, 2023
  • 3 replies
  • 1292 views

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.
Best answer by somen-sarkar

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

arunpatidar
Community Advisor
Community Advisor
April 18, 2023

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
somen-sarkar
Community Advisor
somen-sarkarCommunity AdvisorAccepted solution
Community Advisor
April 18, 2023

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

Siva_Sogalapalli
Community Advisor
Community Advisor
April 18, 2023

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.