Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

AEM Content Services: Using Sling and Node APIs to Provide Asset collections - Part 1 | AEM Community Blog Seeding




AEM Content Services: Using Sling and Node APIs to Provide Asset collections - Part 1 by Perficient Blogs


AEM is a proven framework for application delivery. Intuitive authoring features and HTL (formerly Sightly) driven content views make it easy to put together pages served from an AEM environment. The standard component strategy is great, but AEM offers more flexibility in how you use authored content. AEM Content Services allows authored content to be consumed via a headless CMS approach.

Content fragments offer discrete pieces of text and/or markup, and the Assets API provides references to your assets (including content fragments), all consumable by external apps as JSON.

In a mature DAM, you’ll find you have some images and fragments that are appropriate for external exposure and some that are not. AEM provides Asset Collections to expose specific assets and organize those assets in a simplified way. You can add assets or fragments to a collection from anywhere in the DAM and easily view all items within.

To provide these collections as a part of your headless CMS solution, you need to be able to display them in the JSON response provided by the Sling GET servlet. The out-of-the-box fragments implementation allows you to use content references, but that only serves a reference to the collection, it doesn’t provide the content within. Using the familiar Sling model + HTL component pattern, the code here enables access to the elements in a collection:


There are a few things to note here, as this is a Sling model you have access to the configured dialog properties via the ValueMapValue annotation. Via the Source annotation, you have access to a resource resolver which is managed by Sling.

Read Full Blog

AEM Content Services: Using Sling and Node APIs to Provide Asset collections - Part 1


Please use this thread to ask the related questions.

Kautuk Sahni

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies