Forum Discussion

Elixor's avatar
15 years ago

[REST API] Problem to sort messages

Hi all,   I hope you will be able to help as I'm out of ideas :)   I'm starting to look at the REST API for some work and I might have missed something from the documentation.   I'm simply tryi...
  • EricH's avatar
    EricH
    15 years ago

    Looks like you want "/messages/linear" instead of "/messages/threaded". So, for your original example:

     

    restapi/vc/threads/id/xxxxxxxx/messages/linear?page_size=10&page=8&message_viewer.message_sort_order=thread_ascending

     

    The short answer:

    If the board is being displayed in the UI as "Linear Format" (the default, and depending on setup, potentially the only view), linear would be the corresponding REST parameter. If it's "List by Topics", it's threaded.

     

    The longer winded one:

    Basically, linear mode displays a forum's replies in the order in which they were posted. In effect, all messages appear as replies to the one prior. Threaded mode displays them maintaining the hierarchy in which responses were made. For a smaller example, imagine a thread is started, message 2 and 3 are initiated as replies to the root, and message 4 is added as a reply to 2. The hierarchy would be:

     

     

    1
    |-2
    |--4
    |-3

     

    Admittedly, in a Forum only shown in the UI in linear mode, this REST result could be confusing.

     

    Note that the sort order still applies, but the different views change the meaning of ascending/descending.