Out of Box REST API Component | Community
Skip to main content
Level 3
April 18, 2017
Solved

Out of Box REST API Component

  • April 18, 2017
  • 6 replies
  • 2980 views

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.  

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 smacdonald2008

"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 

6 replies

MC_Stuff
Level 10
April 19, 2017

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-phpapp01.pdf   

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-post.html
https://sling.apache.org/documentation/bundles/rendering-content-default-get-servlets.html

AEM_Forum
Level 10
April 20, 2017

Hi,

The link http://apachecon.com/presentation/materials/0000/0531/restful-sling-bdelacretaz-2010-101103132313-phpapp01.pdf    is resulting in "404 Not Found" error.

Kindly suggest.

Thanks,

Rama.

kautuk_sahni
Community Manager
Community Manager
April 20, 2017
AEM_Forum
Level 10
April 20, 2017

This works.

Thanks,

Rama.

Level 3
April 21, 2017

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

smacdonald2008
smacdonald2008Accepted solution
Level 10
April 21, 2017

"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