Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Best way to consume Third party rest api

Avatar

Level 2

What is best method to use third party rest api. According to me there are two ways.

Approach 1. Make JavaScript Ajax Calls to consume the REST API.
Approach 2. Use a HttpClient on the OSGI Service Layer to consume these services.

What is they best way and why. Can you please help. 

1 Accepted Solution

Avatar

Correct answer by
Level 4

Back end is the way to go as you have much better control with Java/OSGi. Use front end to display the data. 

There is a sample package and article for this use case: 

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

This will point you in the right direction. 

View solution in original post

4 Replies

Avatar

Administrator

Hi 

It really depends on the use-case we are trying to achieve.

Front-End

1. Load on server reduces.

2. Number of hops to the data reduces.

3. If we are using public api's.

 

Back-End

1. Can be more Secure 

2. If authentication is needed them Back-End is considered.

3. If we are calling same API's over and over, then we can save/cache the data (caching) and revert immediately.

4. if we need to change/validate the data so Back-end is used.

 

Article:- http://programmers.stackexchange.com/questions/229079/should-the-views-or-front-end-server-call-the-...

 

I hope this will answer your problem.

Thanks and Regards

Kautuk Sahni

Avatar

Correct answer by
Level 4

Back end is the way to go as you have much better control with Java/OSGi. Use front end to display the data. 

There is a sample package and article for this use case: 

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

This will point you in the right direction. 

Avatar

Level 10

I agree with Steve - Approach 2 is far better way to consume a 3rd party Restful service. 

Avatar

Level 2

The URL in these answers really need to be updated. There's a lot of old accepted solutions here with dead documentation links.