I would like to be able to get the 20 most recent posts that are top level on a topic without having to recursively re-fetch and filter post replies until I have 20. Is there a filter for this and I have just missed it somewhere in the api?
Right now it just looks like the stream array in response includes post replies by post number. So, if I have 4 posts, [1,2,3,4] and post a reply to post 1, the stream will now be [1,2,3,4,5] and the only way I can tell that 5 is a reply to 1 is by examining the post itself, finding “reply_to_post_number”=>1 and filtering it out. Am I missing something?
That is correct. There is not a filter that can be added to the topic endpoint to get what you are after. However we do have the
which you could use to write a sql query to get what you are after. You can then save that query and hit the api endpoint for the saved query and pass it a topic_id as a param.
There isn’t a real way to get what you actually want out of this, because the metadata is messy, and people are messy and don’t really care about your analytics too much