What would be the best way to display the last topics excerpts and categories via the API?

AI-generated summary

A user is looking to display the last topics from their Discourse forum on a WordPress website, including excerpts and categories, via the API. Canapin is concerned that making multiple API requests for each topic’s excerpt and category will slow down the page loading. simon suggests caching the category data and excerpts on WordPress to avoid repeated requests and improve performance.

Greeting.
I’m looking to display the last topics of my Discourse forum on a Wordpress website.
I’ve made a WP plugin which grabs /latest.json data and displays them to my WP users in a widget.

However, besides the title, view/reply counts and most active posters, I’d like to display an excerpt from every topic as well as their category.

I need another request for the categories, but what about the excerpts? Should I do one additional API request for every topic in order to make an excerpt?

If I want to display the 5 last topics with an excerpt and the category, that would be like 7 requests? Do you think that would slow significantly the WP page loading?

You can save the Discourse category data on WordPress so that you don’t have to keep requesting it. The same idea works for excerpts. Once you have the excerpt for a topic on WordPress, you shouldn’t need to fetch it again from Discourse.