Forum Discussion

allina11224's avatar
allina11224
Contributor
6 years ago

attempting to pull all message content in threads

I need to conduct a sentimental analysis on our developer community forum. I need an endpoint that will return the body of all the messages from a single post. 

After thoroughly reading the lithium API documentation and experimenting with various endpoints, I haven’t found anything that does this. The best I can get is an endpoint that prints all messages in a scattered format.

API endpoint: 

https://community.developer.[insert_domain].net/api/2.0/search?q=SELECT+subject, body, post_time+FROM+messages+ORDER+BY+post_time+desc

 

To avoid storing thousands of messages locally and ordering them myself, I was wondering if there is anything I missed that prints all the messages in order of thread. 

  • allina11224 

    To fetch all messages associated with a particular post, you can use the constraint where  topic.id='[Unique ID for the message]'

    Eg.you can try the following by replacing '3415' with the ID for the post, of which you require all messages

    https:/[your domain]/api/2.0/search?q=SELECT * from messages where topic.id='3415' order by post_time desc

     This will fetch you all the replies associated with the message/post.

    Here is the link for documentation of the same.

    https://developer.khoros.com/khoroscommunitydevdocs/docs/liql-examples

    Hope this helps.

    Please give kudos if you find this post useful and mark it as Solution if it answers your query.

    Regards

    Tarun Kumar

     

  • In addition to that, if you just want to get all the replies from the your last 10 topics in board with id 'devforum':

    (only replies: depth > 0, only topics: depth = 0)

    SELECT id FROM messages WHERE board.id = 'devforum' AND depth = 0 ORDER BY post_time DESC LIMIT 10

    Now just list through the returned ids with what Tarun wrote.

  • allina11224 

    To fetch all messages associated with a particular post, you can use the constraint where  topic.id='[Unique ID for the message]'

    Eg.you can try the following by replacing '3415' with the ID for the post, of which you require all messages

    https:/[your domain]/api/2.0/search?q=SELECT * from messages where topic.id='3415' order by post_time desc

     This will fetch you all the replies associated with the message/post.

    Here is the link for documentation of the same.

    https://developer.khoros.com/khoroscommunitydevdocs/docs/liql-examples

    Hope this helps.

    Please give kudos if you find this post useful and mark it as Solution if it answers your query.

    Regards

    Tarun Kumar

     

    • In addition to that, if you just want to get all the replies from the your last 10 topics in board with id 'devforum':

      (only replies: depth > 0, only topics: depth = 0)

      SELECT id FROM messages WHERE board.id = 'devforum' AND depth = 0 ORDER BY post_time DESC LIMIT 10

      Now just list through the returned ids with what Tarun wrote.