API: Seach for posts with images and then retrieve detailed post data with search's post_ids

Hi Discourse folks,
I am currently building a feature where I want to display a small teaser grid at the top of the page that displays “interesting” posts/topics in a grid format. I am not sure maybe there is something similar out there but I haven’t found it - do you know?

In order to find the posts I am interested in I am running:
/search.json?expanded=true&q=with%3Aimages%20after%3A2021-10-14%20order%3Alatest

This then returns me an array of the posts → grouped_search_result.post_ids

Now I actually want to run a query that returns me only these posts with detailed information such as raw data and cooked. And I want to avoid spamming ajax requests for every single postid that I find. I was hoping there is a batch operation I can use where I simply pass all the IDs and it returns me the posts.

I tried with posts.json and various URL param formats but couldn’t get it to work.
I also just discovered this one here which I find helpful but the multipost query question still stands.

Thanks for any help

I think you might need a plugin that adds the information you want to the serializer.

1 Like