Extending the Delivery API
a

Andrew McKaskill

9 months ago
Hi, I'm looking for advice on how best to extend/modify the output of the delivery API for specific document types. Here's the secenario: We got a carousel on the home page that shows cards that promote various pages within the site, or link to other sites. Currently, the carousel is implemented as a block list with an single Card element. The card has title, text, and link fields, which have to be filled in manually. What I'd really like is, that if the user selects an existing content page as the link, that the title, text and thumbnail image are pulled automatically from THAT content page, rather than having to be re-entered. This would probably look like two different types of cards: a manual card, and an automatic card. The manual card has all the existing fields which are marked as required. The automatic card has a content picker instead of a link property. Questions for the community: - If you have a content picker property, how easy is it to "update" other fields on the same element with data based on the item picked? - Once the link is selected, can I extend the delivery api somehow so that when it's rendering my automatic card, it goes and gets the properties of the linked item and exposes them as fields without requiring the "expand" property or an additional call to the api? Any other thoughts or suggestions? https://cdn.discordapp.com/attachments/1334453829462261822/1334453829927698442/image.png?ex=679c967a&is=679b44fa&hm=543976e348eba65e8f406e42ba2cc92db66ff74d7dccb6520ba7fca10bbaee50&