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

Retrieve latest content from AEM Repository

Avatar

Avatar
Boost 3
Level 2
hanscy
Level 2

Likes

3 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile

Avatar
Boost 3
Level 2
hanscy
Level 2

Likes

3 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile
hanscy
Level 2

20-12-2018

Hi guys,

I got a requirement to be able to retrieve content from AEM repository on a web page once it is published, ie. retrieve the latest publish content.

Using the JavaScript Use API is somehow possible as well, however once the latest content published it won't display directly on the client/user machine as the dispatcher cache the content and we will need to flush the dispatcher cache to be able to retrieve the new content.

Doing that is somehow ineffective if we have a large number of content inside the repository already.

any sorts of suggestions / best practice how to do it?

Thanks!

Replies

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,129 likes

Total Posts

6,140 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,129 likes

Total Posts

6,140 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

07-01-2019

Jörg Hoh​ Any help on this one?

Avatar

Avatar
Give back 300
MVP
Gaurav-Behl
MVP

Likes

243 likes

Total Posts

1,145 posts

Correct Reply

281 solutions
Top badges earned
Give back 300
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Give back 300
MVP
Gaurav-Behl
MVP

Likes

243 likes

Total Posts

1,145 posts

Correct Reply

281 solutions
Top badges earned
Give back 300
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
Gaurav-Behl
MVP

07-01-2019

Javascript Use API is typically used by HTL which is a server-side language.

Use client side jquery ajax ($.ajax) or Apache Sling Dynamic Include or any other similar framework

Adobe Experience Manager Help | Set up Sling Dynamic Include in AEM

GitHub - Cognifide/Sling-Dynamic-Include: Sling Dynamic Include

http://api.jquery.com/jquery.ajax/

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,089 likes

Total Posts

3,122 posts

Correct Reply

1,063 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,089 likes

Total Posts

3,122 posts

Correct Reply

1,063 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

07-01-2019

Hi,

I read your question, but I don't understand it. I understood that you want to fetch the latest published content, but the second paragraph doesn't make sense to me. Can you rephrase your question?

Thanks,

Jörg

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

07-01-2019

I agree with Joerg - your question is not clear. You want to query latest published content. What purpose is this for? Do you want to track pages that are published for reporting purposes?

Avatar

Avatar
Boost 3
Level 2
hanscy
Level 2

Likes

3 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile

Avatar
Boost 3
Level 2
hanscy
Level 2

Likes

3 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile
hanscy
Level 2

07-01-2019

Hi Joerg,

Thanks for the reply Joerg!

What I wanted to say on the second paragraph is basically one of the possibility to fetch the latest published content from the JCR. However it is not a really good solution (ineffective)  as it is using the JS Use API which is a server-side language and potentially put a heavily load on the server.

so to summarise it, the question is basically, is there any other solutions that we can implement to fetch the latest published content so that the user can get suggestions on the latest published article once the article is published?

Avatar

Avatar
Boost 3
Level 2
hanscy
Level 2

Likes

3 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile

Avatar
Boost 3
Level 2
hanscy
Level 2

Likes

3 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile
hanscy
Level 2

07-01-2019

the purpose is not to track pages that are being published, the purpose is to promote / display the latest published articles to users.

Avatar

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

273 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

273 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
edubey
Level 10

07-01-2019

Yes, you can achieve it. But in this case your this particular request has to pass from dispatcher without caching.

gauravb10066713​ has already mentioned few recommended approach which is used to tackle this like SDI, Ajax

Avatar

Avatar
Boost 3
Level 2
hanscy
Level 2

Likes

3 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile

Avatar
Boost 3
Level 2
hanscy
Level 2

Likes

3 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile
hanscy
Level 2

07-01-2019

Hi,

Thanks for that! what will be the AJAX solutions looks like? do you have any example?

I am keen to look at the solution example if you have any with AJAX.

Avatar

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

273 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

273 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
edubey
Level 10

07-01-2019

I don't have the details of your requirement but on a high level, you will have to create an endpoint in your aem (using servlet). These endpoint will be responsible for sending response with updated content. From front-end you will be requesting these endpoint and consume the response.

Some helpx articles you can refer to

https://helpx.adobe.com/experience-manager/using/aem64_mbean.html

https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

https://helpx.adobe.com/experience-manager/using/toy_login.html