Forum Discussion

tripp-bishop's avatar
12 years ago
Solved

Getting message subscription info for post via REST

We have a custom UI for creating forum posts and we're using the an endpoint to create/edit these posts. We're just using the standard messages/id/edit and /boards/id/my-board-id/messages/post calls to make this happen. We have a checkbox that allows the user to subscribe to the thread via the message.subscribe_type=thread parameter in the URL (just like the "email me when someone replies" in the form I'm using here).

 

My qusetion is, once we set this value (we're setting it to "thread" right now), how do we later retrieve that fact? This is of particular interest when the user is editing the post via the custom UI. We need to know whether or not to set the checkbox to checked or not. The only call I see in the API is /messages/id/${message_id}/subscriptions/users/self/type/email, but that's not returning anything for my message. Is there some other call I need to make to find this info?

 

Cheers,

 

Tripp

  • AdamN's avatar
    AdamN
    12 years ago

    The types for a subscription are: bookmark, float, email. So that could be why your call is failing.

     

    If you're subscribing the user to the thread instead of an individual message, try getting a ThreadSubscriptionContext instead:

    /restapi/vc/threads/id/83400/subscriptions

     For example:

    /restapi/vc/threads/id/83400/subscriptions/users/self/type/email

     

     

6 Replies

  • I get the following response when I try /messages/id/${message_id}/subscriptions/users/self/type/thread:

     

     

        <response status="error"><error code="502"><message>
          Invalid path element.
        </message></error></response>

     

    I also tried /messages/id/${message_id}/subscriptions/global/type/thread which generates the same response:

     


        <response status="error"><error code="502"><message>
          Invalid path element.
        </message></error></response>

  • AdamN's avatar
    AdamN
    Khoros Oracle
    12 years ago

    The types for a subscription are: bookmark, float, email. So that could be why your call is failing.

     

    If you're subscribing the user to the thread instead of an individual message, try getting a ThreadSubscriptionContext instead:

    /restapi/vc/threads/id/83400/subscriptions

     For example:

    /restapi/vc/threads/id/83400/subscriptions/users/self/type/email

     

     

  • VenkS's avatar
    VenkS
    Lithium Alumni (Retired)
    12 years ago

    Could you confirm that the REST API call is working? Once you run the call, can you see that the user is subscribed for that message/thread in the UI?

  • dhiraj_gophane's avatar
    dhiraj_gophane
    Leader
    11 years ago

    Hi Adam,

     

    I am using the same call which you have mentioned.

     

    But I'm getting following response:

     

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <response status="success">
    <subscription type="subscription" null="true"/>
    </response>

     

    User does not get subscribed to thread.

    Can you please help.

     

    Thank you.

     

    Regards,

    Dhiraj