Hi All,
Can someone explain me if we can make rest api call from javascript use api with an example?
Also, we are using reactJS to make a call to backend, can we achieve the same with javascript use api and should we use reactJS only?
Thanks
Madhu
Views
Replies
Total Likes
A better approach is to use WCMUsePojo with HTL to make a Restful call to a 3rd party service - as explained here: Creating an Adobe Experience Manager 6.4 HTL Component that displays data from a Restful Web Service
Views
Replies
Total Likes
But this will be a server call right? My requirement is to make client calls like react JS do. Any best approach then using reactjs???
Views
Replies
Total Likes
If you requirement is to make a call on the client - then you can use react to make a rest call. This could be done in script file located in a client lib. See this thread for more information -- json - Making REST calls from a react component - Stack Overflow
Having said that - if the requirement is to make a call to a Restful web service - like a Google service - and display the result set in a component -- its better to make the call on the server using Java/WCMUsePojo - as shown in the above article.
Views
Replies
Total Likes
Hi smacdonald2008,
Yeah i agree with you. But in my case application do lot of api calls (REST) to other layers such as SAP. If there are so many requests it will put lot of load on publishers as java, javascript use api is service side. Hence, am looking for other alternative which can be handled at aem level.
Views
Replies
Total Likes
Then use the JS USE API and then make a Rest call using JS.
Views
Replies
Total Likes
JS USE API is still a server call right?
Views
Replies
Total Likes
Views
Likes
Replies