what is the optimal way to consume weather API where particular city weather should be shown in the page dynamically? | Community
Skip to main content
Level 4
March 14, 2022
Solved

what is the optimal way to consume weather API where particular city weather should be shown in the page dynamically?

  • March 14, 2022
  • 1 reply
  • 1431 views

if you could explain with example that will be helpful.

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 DEBAL_DAS

@debal_das ,Thanks for response.

 

case 1: is it same for if weather data is 3rd party API?

 

case 2: Yes, do we have any example available ?


case 1: yes, I did the similar implementation with 3rd party API to populate stores based on UK postcode. We made ajax call to get list of stores and this approach helped the browser  to continue loading the other content on the page simultaneously.

 

case 2: If you are dealing with huge json data then you could use Google's https://github.com/google/gson.

Please refer this : https://www.aemtutorial.info/2019/05/ 

The same  point has been highlighted here also : https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-where-to-store-json-files-to-access-json-as-it-is-in-ui/m-p/272656

 

 

 

 

1 reply

DEBAL_DAS
New Member
March 14, 2022

1. As you are going to deal with dynamic data so please use Sling Dynamic Include as explained here

https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/development/set-up-sling-dynamic-include.html?lang=en

 

2. Level of complexity during processing like extract the requisite data fields from the amount/volume data receive from the weather api and display on page . Based on amount/volume of data you need to take the decision whether you want to extract the data via front end or Back end logic.

Debal Das, Senior AEM Consultant
Level 4
March 14, 2022

One case: lets say we need to display only a city name and its weather data, so how will be achieving this in optimal way?

Second case: if its huge data and we need to consume  and display it in AEM Page? how to approach this and solve this in optimal way?

DEBAL_DAS
DEBAL_DASAccepted solution
New Member
March 15, 2022

@debal_das ,Thanks for response.

 

case 1: is it same for if weather data is 3rd party API?

 

case 2: Yes, do we have any example available ?


case 1: yes, I did the similar implementation with 3rd party API to populate stores based on UK postcode. We made ajax call to get list of stores and this approach helped the browser  to continue loading the other content on the page simultaneously.

 

case 2: If you are dealing with huge json data then you could use Google's https://github.com/google/gson.

Please refer this : https://www.aemtutorial.info/2019/05/ 

The same  point has been highlighted here also : https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-where-to-store-json-files-to-access-json-as-it-is-in-ui/m-p/272656

 

 

 

 

Debal Das, Senior AEM Consultant