Assets HTTP API pagination and dispatcher caching | Community
Skip to main content
mpalme1
Level 3
Dec 18, 2020 2:15 PM UTC
Solved

Assets HTTP API pagination and dispatcher caching

I am working on a component that loads content fragment data with javascript and a request to the assets HTTP API. I need a full result set but the response is paginated as described here:

https://experienceleague.adobe.com/docs/experience-manager-65/assets/extending/assets-api-content-fragments.html?lang=en#available-features
If I passed ?limit=150, I would get all my results, but then the dispatcher won't cache the response without me setting a global ignoreUrlParams configuration as described here:

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-configuration.html#configuring-the-dispatcher-cache-cache

I need a more precise (not global) way to solve this that doesn't prevent dispatcher caching. I've considered writing a custom servlet to return the data, but if there's better, more out-of-the-box approach to this, I'd prefer it.

Suggestions?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Kunal_Gaba_
Kunal_Gaba_Accepted solution
New Participant
Dec 18, 2020 3:56 PM UTC

Another option is to rewrite the API url on the live page JS code so that it passes the page size as a selector in the URL. Like - /api/assets/cf.150.json. And then you can add a rewrite rule in Apache to remove the selector and add it as a query param before it passes the URL to AEM for processing. However, on AEM author instance you will have to to use regular query param based URL only. 

2 replies

Kunal_Gaba_
Kunal_Gaba_Accepted solution
New Participant
Dec 18, 2020 3:56 PM UTC

Another option is to rewrite the API url on the live page JS code so that it passes the page size as a selector in the URL. Like - /api/assets/cf.150.json. And then you can add a rewrite rule in Apache to remove the selector and add it as a query param before it passes the URL to AEM for processing. However, on AEM author instance you will have to to use regular query param based URL only. 

Translate
mpalme1
mpalme1Author
Level 3
Dec 18, 2020 5:41 PM UTC
Thanks, @kunal_gaba_. Great idea.
Translate