Expand my Community achievements bar.

SOLVED

AEM 6.5, questions for 3rd party data stored into AEM

Avatar

Level 2

Hello,

My AEM application depends on data from a 3rd party API which will be used to render HTML on the page. I understand data from 3rd party API is recommended to be stored in AEM, so it can improve performance overall effort

  1. Old aem is recommended to store data under /etc, how about about AEM 6.5?
  2. How is the 3rd party data, saved as nodes, invalidated?
  3. How is the data within the saved nodes refreshed?
  4. What is the best practice to invoke the 3rd party data saving mechanism?

example JSON response from the 3rd party API (2,000 cars):

 

[
   {
      "manufacturer":"Porsche",
      "model":"911",
      "price":135000,
      "wiki":"http://en.wikipedia.org/wiki/Porsche_997",
      "img":"2004_Porsche_911_Carrera_type_997.jpg"
   },
   {
      "manufacturer":"Nissan",
      "model":"GT-R",
      "price":80000,
      "wiki":"http://en.wikipedia.org/wiki/Nissan_Gt-r",
      "img":"250px-Nissan_GT-R.jpg"
   },
   {
      "manufacturer":"BMW",
      "model":"M3",
      "price":60500,
      "wiki":"http://en.wikipedia.org/wiki/Bmw_m3",
      "img":"250px-BMW_M3_E92.jpg"
   },
   {
      "manufacturer":"Audi",
      "model":"S5",
      "price":53000,
      "wiki":"http://en.wikipedia.org/wiki/Audi_S5#Audi_S5",
      "img":"250px-Audi_S5.jpg"
   },
   {
      "manufacturer":"Audi",
      "model":"TT",
      "price":40000,
      "wiki":"http://en.wikipedia.org/wiki/Audi_TT",
      "img":"250px-2007_Audi_TT_Coupe.jpg"
   }
   ...
]

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@karthik4  Can the content be cached? How frequently the other side content changes? Is it secure or public content?

 

Based on the above responses, 

If on webpage and should not be cached, I would prefer this to happen at frontend javascript if the api is doesnt serve confidentiality content.

For other purposes if data is simple, I would prefer to write a sling model and store the data inside jcr under some data-page if that can be reused across other page, and call this model once to inject all data into the page via json or data attributes and javascript do the rest.

 

If the data is huge, instead of json or data attributes to you may need to put some flags to check and call rest api only once and for subsequent calls refer to jcr nodes. Or other option is to go with scheduler if api content changes are scheduled.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

@karthik4  Can the content be cached? How frequently the other side content changes? Is it secure or public content?

 

Based on the above responses, 

If on webpage and should not be cached, I would prefer this to happen at frontend javascript if the api is doesnt serve confidentiality content.

For other purposes if data is simple, I would prefer to write a sling model and store the data inside jcr under some data-page if that can be reused across other page, and call this model once to inject all data into the page via json or data attributes and javascript do the rest.

 

If the data is huge, instead of json or data attributes to you may need to put some flags to check and call rest api only once and for subsequent calls refer to jcr nodes. Or other option is to go with scheduler if api content changes are scheduled.