Public
Occasional Contributor

API to show all posts in a thread

I'm trying to get a hang of API so that we can use it to display all posts for every day. 

 

https://community.website.com/api/2.0/search?q=select%20*%20from%20messages%20where%20post_time%20>%20{$startDate}T{$startTime}.000-00:00%20and%20post_time%20<%20{$endDate}T{$endTime}.999-00:00%20limit%201000

 

I was using something similar.

 

However, my major issue is to display the entire thread, including the posts that are there.


Should be something like this, but it's just showing me the opening post, not the others. I tried a lot of combinations in the past hour or so. 

 

select * from messages where topic.id = '$number'

 

 

How to use API and show the data of an entire thread?

1 Reply 1
Honored Contributor

@djondinium,

 

select * from messages

Will return you all messages with topic and replies.

If you want to see all the main topic/threads from a particular time, you can use below API.

https://community.website.com/api/2.0/search?q=select * from messages where depth=0 AND post_time > {$startDate}T{$startTime}.000-00:00 and post_time < {$endDate}T{$endTime}.999-00:00 limit 1000

This will return you main topic id, then you can use your other query in the list to get the replies of that topic from it.

select * from messages where topic.id = '$topic_id'

 

.......
Do you know we work with Kudos and Accepted Solution.

Welcome to the Technology board!

Curious about our platform? Looking to connect on social technology? You've come to the right place!

Are you a Khoros customer? For direct assistance from our Support team, please visit the Support Forum.