Forum Discussion

omygoodness's avatar
8 years ago

How to display all community messages?

Is there a way to display all messages for whole community using rest API?  
  • PaoloT's avatar
    PaoloT
    8 years ago

    omygoodness wrote:

    Thank you.

    I have another question. If you use:

    SELECT * FROM messages limit 1000

     or

    posts/messages?filter=&page_size=1000

    you will get all messages across whole community but how to filter out messages from hidden categories or that messages which are not public?


     

    Hi

    Just make sure that your call is made using the rest freemarker method (if you are writing a component), so that it will be made using the  permissions of the user who is viewing the component (or the anonymous user if none is logged). If you are calling the API programmatically, make sure you are using the appropriate session key / authentication for the relevant user. This will ensure only the messages that user can view are returned.

     

    If you call using restadmin (in freemarker), or with Administrator privileges, then you will see all messages.

     

    Hope it helps,

  • VarunGrazitti's avatar
    VarunGrazitti
    8 years ago
    omygoodness - The rest() call will work the same way in the endpoint as well, so you will only get the public messages.