Expand my Community achievements bar.

SOLVED

How to connect AEM with Rest Api

Avatar

Level 1

Are there any steps to connect to AEM using Rest Api, if any body has come across this situation then please repond back with set of steps or any help.

Thanks

Santosh

1 Accepted Solution

Avatar

Correct answer by
Level 1

Hey, thanks for the reply. I came to know that I was getting java.net.UnknowHostException due to the restriction policy at my company. It worked fine when I connected wifi to my mobile network. :)

View solution in original post

7 Replies

Avatar

Level 10

You can create your own AEM service using an OSGi bundle that contains Java API that invokes Restful services. See this community article:

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

As an example -- it uses a Google Restful web service.

Avatar

Level 1

Hi Santosh,

If i am not wrong you are asking about calling a REST service from CQ5. Please find the below code line which tells to call REST service from JSP using AJAX call.

$.ajax({
         type: "POST",
         contentType: "application/json",
         dataType: 'json',
         url: 'REST Service URL', -- Need to be changed
         data: JsonJSquery, -- Need to be changed
         async: true,
         success: function(data){
           //Code to be written
           }      
         });

Thanks.

Avatar

Level 1

Hi,

I tried the same, but getting null in response. Any idea what's the problem?

 

Thanks

Avatar

Community Advisor

Hi,

Scott has provided you Helpx article you can follow that.

Additionally you can also check "https://helpx.adobe.com/experience-manager/using/restful_htl.html".

I have recently successfully worked with it. Also it is tested by Certified developer Ratan Kumar. let us know if you will face any issue.

~ Prince Shivhare

Avatar

Correct answer by
Level 1

Hey, thanks for the reply. I came to know that I was getting java.net.UnknowHostException due to the restriction policy at my company. It worked fine when I connected wifi to my mobile network. :)

Avatar

Level 2

Will this work with AEM 6.3? There are sample downloads available specific to 6.1 and 6.2, but not 6.3 and the Article Summary Version row states

VersionAdobe Experience Manager 6.1/ 6.2

Avatar

Level 2

When I downloaded and installed the 6.2 package and tried it out, I got a SightlyException error after submitting the two cities input:
"Cannot find a file corresponding to class com.community.rest.core.HeroRestComponent in the repository."