Forum Discussion

BradR's avatar
BradR
Khoros Alumni (Retired)
12 years ago

Getting Private messaging via REST API

Hi All,

 

I have uncovered the following in order to send private messages:

 

http://community.lithium.com/community-name/restapi/vc/postoffice/notes/send

 

Is there a method that will allow me to retrieve private messages via rest API?

 

Thanks,

 

 

    • ginakache's avatar
      ginakache
      Contributor

      Hello,

       

      i'm trying to send a private message to multiple recipients using the Rest api postoffice/notes/send

       

      It works fine with one recipient, but i can't get it to work with multiple recipients.

       

      Is this possible? how?

       

      Thanks.

       

      Gil

      • ChhamaJ's avatar
        ChhamaJ
        Khoros Staff

        Hey Gil,

        Unfortunately postoffice/notes/send call only supports one recipient at a time, but what you can do is if you have endpoints enabled in Studio, then create an endpoint which first gets all the users and then passes one user at a time to this call.

        A sample code should look like this

        <#assign listusers = restadmin("/users").users />
        <#list listusers.user as user >
        <#assign respone = restadmin("/postoffice/notes/send?notes.recipient=id/${user.id}&notes.subject=test4&notes.note=test4").response />
        </#list>

         
        Hope this helps,

        Regards,
        Chhama