Forum Discussion

bdelaune's avatar
bdelaune
Contributor
11 years ago

Rest API search to Discussion Style

Hi. I'm working on a project where the client would like to be able to search the community (this is very easy with the REST API.  From there, within their current application, they would like to view and navigate the thread as if they were on the website (without leaving the current tool).

 

I'm running into a problem when searching and then rendering the appropriate thread.  For example, let's say the user clicks on once of the results in the search.  I want to be able to display the page of the thread that message resides on.  From what I can tell the /restapi/thread/[id]/messages/linear will not allow me to say which message's page I'd like.  Is there a better way to approach this?  Let me know if I'm not making any sense.

  • AdamN's avatar
    AdamN
    Khoros Oracle

    Hi bdelaune,

     

    I'm not sure I fully understand what you're looking for. Are you just wanting to page through the results of the "/restapi/thread/[id]/messages/linear" call? If so, that call should accept the "page" and "page_size" parameters. So for example if you wanted to get 50 messages at a time:

    /restapi/thread/[id]/messages/linear?page_size=50&page=1

    /restapi/thread/[id]/messages/linear?page_size=50&page=2

    /restapi/thread/[id]/messages/linear?page_size=50&page=3

    ...

     

    If you were looking for something different, could you please try to explain more?

    • bdelaune_hp's avatar
      bdelaune_hp
      Contributor

      Thanks for your help, but let me clarify what I am asking.

       

      We are utilizing the Community/Search/Messages api to get back a list of search results.  When someone searches on the website and click on a link, it not only takes them to a linear version of the thread, but it also directs them to the correct page of the thread in order to view the message that matched their search results.

       

      We are attempting to replicate this functionality within a tool on an internal system.  Ideally, when a user clicks on one of the search results, they are directed to a page that renders a linear view of the thread and brings them directly to the page they need to be on to view the message that matched their search.  As far as I can tell, there is no programmatic way to determine which number a message is in the linear view of a thread.  That is what we need.