Best way to consume Third party rest api | Community
Skip to main content
Level 2
June 8, 2016
Solved

Best way to consume Third party rest api

  • June 8, 2016
  • 4 replies
  • 3454 views

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. 

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 stevec2515680

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. 

4 replies

kautuk_sahni
Community Manager
Community Manager
June 8, 2016

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-restful-api-layer

 

I hope this will answer your problem.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
stevec2515680Accepted solution
Level 4
June 8, 2016

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. 

smacdonald2008
Level 10
June 8, 2016

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

Level 2
August 31, 2022

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