Search code examples
curlaemjcr

How to fetch all web pages from under a directory in JCR using CURL in CQ?


I want to fetch all web pages(recursively) from under a directory in my CQ content using curl. Can someone please help?


Solution

  • The Apache Sling JSON GET servlet is enabled by default in CQ so provided access control allows it you can retrieve subtrees with URLs like /content.tidy.N.json where N is the desired recursion level.

    As an example,

    curl -s -u admin:admin http://localhost:8080/content/geometrixx.tidy.2.json
    

    Retrieves two levels of the tree under /content/geometrixx.

    If the result contains more elements than a configurable limit you'll get a 302 response that lists the URLs that provide the result in multiple smaller units.

    See also http://sling.apache.org/documentation/bundles/rendering-content-default-get-servlets.html