Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Out of Box REST API Component

Avatar

Level 3

Is there any out of box REST API component in AEM 6.1/6.2 ? My use case is need to invoke the REST API on page load and display the content on page, if there any AEM out of box component, just want to use that.  

1 Accepted Solution

Avatar

Correct answer by
Level 10

"I am basically looking to consume third party REST API"

We have an end to end article on how to write a AEM Component that can invoke a 3rd party Restful endpoint: 

1 - https://helpx.adobe.com/experience-manager/using/restful-services.html

2 - http://scottsdigitalcommunity.blogspot.ca/2016/09/creating-aem-html-template-language.html (displays the data in a HTL component). This has a video too on the AEM Commmunity YouTube Channel 

View solution in original post

6 Replies

Avatar

Level 9

Hi Chandra,

By default aem is Restful & there is no specific end point. All request are resources. Sling resolution [0] is an key in understanding to access the info you are looking.  [1] are the one I use a reference to understand initially.    My experience for POST operations [3] helps a lot for manupulation.  

 Sling is resource centric & features in product is vast not able to cover all in doc.   In general the basic AEM training covers the restful architect .  The below article have complete example  http://apachecon.com/presentation/materials/0000/0531/restful-sling-bdelacretaz-2010-101103132313-ph...   

Below is simple example.

Create
curl -u admin:admin  -Ftitle=hi http://localhost:4502/foo

GET in json format
curl  -u admin:admin  http://localhost:4502/foo.json

Update
curl -u admin:admin  -Ftitle=hiupdate http://localhost:4502/foo

Delete
curl -u admin:admin  -F:operation=delete http://localhost:4502/foo

 

 
[0]
https://kksays.files.wordpress.com/2016/07/sling-cheatsheet.png
 
[1]  
http://www.slideshare.net/royfielding/rest-in-aem
https://docs.adobe.com/docs/v5_1/html-resources/cq5_guide_developer/ch02s08.html
http://www.slideshare.net/DEEPAKKHETAWAT/rest-and-sling-resolution-47406906
 
 
[3]
https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-po...
https://sling.apache.org/documentation/bundles/rendering-content-default-get-servlets.html

Avatar

Level 3

Thank you MC, it is really helpful. Am basically looking to consume third party REST API. So I assume no OOB component

Avatar

Correct answer by
Level 10

"I am basically looking to consume third party REST API"

We have an end to end article on how to write a AEM Component that can invoke a 3rd party Restful endpoint: 

1 - https://helpx.adobe.com/experience-manager/using/restful-services.html

2 - http://scottsdigitalcommunity.blogspot.ca/2016/09/creating-aem-html-template-language.html (displays the data in a HTL component). This has a video too on the AEM Commmunity YouTube Channel