We want to get all of the first posts in a category (which we are using as wikis but not actually wikis).
Preferably, we’d like to avoid having to do one request per topic/post.
The best way have so far is using search to get topics, and then get the topics one by one and take the first post out of the stream.
Web hooks will be a good option in the future but we’d like to start with PULL.
thanks!
1 Like
Bumping this to see if anyone had an idea?
blake
(Blake Erickson)
October 4, 2021, 3:01pm
3
John_Lehmann:
Preferably, we’d like to avoid having to do one request per topic/post.
The best way have so far is using search to get topics, and then get the topics one by one and take the first post out of the stream.
I’m not aware of a bulk way of getting the first replies to many topics. Iterating through each topic and grabbing the first post is probably the best option.
Yes, webhooks really are a good option here and you can trigger off the “Post Event”.
But this would trigger for EVERY post event and you’d just have to ignore all the posts that aren’t the first reply on a topic.
2 Likes
simonk
(Simon King)
October 4, 2021, 3:43pm
4
Could you write a data-explorer query that returns the data that you want, and then execute that query via the API?
Virtually any action that can be performed through the Discourse user interface can also be triggered with the Discourse API. For a general overview of how to find the correct API request for an action, see Reverse engineer the Discourse API .
To run a Data Explorer query from the API, you need to make a POST request to /admin/plugins/explorer/queries/<query-id>/run. You can find the a Data Explorer query’s ID by visiting the query on your site and getting the value of the id parameter that yo…
2 Likes
@blake
I don’t suppose the topic event would include changes to the OP?
1 Like
blake
(Blake Erickson)
October 4, 2021, 5:25pm
6
It should trigger for changes. The description for it says:
When there is a new topic, revised , changed , or deleted.
Yes, that is great option!