Try our conversational search powered by Generative AI!

how do people approach returning content api data for listing style pages


we have a number of pages which do most of the work in the controller, such as article listing pages which show 'cards' for child pages beneath them, using the contentrepository to get 10 cards say and then use a load more function to show more.

if you wanted to return these listing pages from the contentapi, how would you approach getting the data for them? as by default they would clearly not contain any of the data for the cards

Mar 31, 2022 10:57

There are many ways to handle that scenario.

You could register an IContentConverter (EPiServer.ContentApi.Core.Serialization) and IContentConverterProvider for your page type and add the associated cards to your API model in that way. There is limited information in the documentation on this:

However, if this is reusable functionality that could be applied to many pages, it could make sense just to create you own cards API, something like:

GET /api/v1.0/{contentIdentifier}/cards/

Then you have complete control over your card model and you de-couple it from the page load.

Apr 01, 2022 11:17
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.