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
BedrockMission!

Learn More

View all

Sign in to view all badges

How to store the json from external system

Avatar

Avatar
Ignite 1
MVP
Ankur_Khare
MVP

Likes

159 likes

Total Posts

370 posts

Correct Reply

58 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile

Avatar
Ignite 1
MVP
Ankur_Khare
MVP

Likes

159 likes

Total Posts

370 posts

Correct Reply

58 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile
Ankur_Khare
MVP

09-03-2020

Hi Team,

 

We have a requirement where in we need to ca ll a 3rd party rest api to get a json response based on which we need to construct all the components on the page.

 

So my question is how shall we call the 3rd party api only once and then all the components use the same json response .

 

Please let us know the correct way of handling this scenario.

Note: we are not using SPA.

 

Regards

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

611 likes

Total Posts

588 posts

Correct Reply

230 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

611 likes

Total Posts

588 posts

Correct Reply

230 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
BrianKasingli
MVP

09-03-2020

@ka 

When dealing with third-party APIs, the best practice is to always think of the best way to offload the server-load from your publishers. Ask questions like: does does this third-party API need to be a par of the HTML within the server-side render? If server-side render is not required, you can invoke the third-party API using Javascript, and with the response, using Javascript to render HTML elements to the page. This practice will keep your AEM publishers more performant and unblocked.

Read more here: https://sourcedcode.com/scenario-building-aem-components-with-3rd-party-integrations-the-right-way

In my experience, the best way to deliver a performant AEM website is to cache all pages. Try migrating all the content from the old CMS to AEM; in this case, you can utilise the Apache Sling Framework to do all the heavy lifting for you. Take a look at the custom data importer service, com.day.cq.polling.importer.Importer API.

 

Answers (1)

Answers (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,346 likes

Total Posts

3,223 posts

Correct Reply

915 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,346 likes

Total Posts

3,223 posts

Correct Reply

915 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

09-03-2020

You can make a request using HttpClient Api from sling servlet/services and store json inside /conf if not exposing to client, otherwise store inside content and use this json.

I would suggest parse/store this json as node, would be easy to access and use later.