How to call 3rd part REST API from AEM (in server side code)

Avatar

Avatar
Affirm 5
Level 4
TB3dock
Level 4

Likes

37 likes

Total Posts

223 posts

Correct reply

5 solutions
Top badges earned
Affirm 5
Ignite 10
Boost 25
Give Back 25
Validate 10
View profile

Avatar
Affirm 5
Level 4
TB3dock
Level 4

Likes

37 likes

Total Posts

223 posts

Correct reply

5 solutions
Top badges earned
Affirm 5
Ignite 10
Boost 25
Give Back 25
Validate 10
View profile
TB3dock
Level 4

02-04-2021

There are some old posts which discuss this, but they point to broken links.

 

e.g. https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/conclusion-consuming-rest-...

 

points to https://helpx.adobe.com/experience-manager/using/restful-services.html which gives 404.

 

https://github.com/brandonmaynard/aem-restful-api has a REST client, but no documentation.

 

https://aem4beginner.blogspot.com/invoke-rest-services-in-aem-right-way uses OpenFeign, which is not a library I have come across, and there is not much information on how to do this with AEM.

 

If this was a normal Java app, we could use jersy, Jax-rs or Spring RestTemplate. I am hoping AEM has one of the standard libraries built in.

 

I am guessing HttpUrlConnection might be included in AEM, in which case we could write our own REST handler on top of this if all else fails.

 

What does everyone use to make API calls from AEM?

 

 

View Entire Topic

Avatar

Avatar
Validate 25
MVP
Singaiah_Chintalapudi
MVP

Likes

131 likes

Total Posts

234 posts

Correct reply

39 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Validate 25
MVP
Singaiah_Chintalapudi
MVP

Likes

131 likes

Total Posts

234 posts

Correct reply

39 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
Singaiah_Chintalapudi
MVP

03-04-2021

I would use Apache Http Client.

https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient

 

The JAX-RS comes with additional dependencies (this download additional javax dependencies) which might have a conflict with Sling dependencies.

 

Thanks,

Singaiah