Forum Discussion

AnchaAjay's avatar
3 years ago

Finding out the subscribers to a categories/Boards/Topics

Hi ,

I am looking for  the Apis for getting the details,count  of a subscribers who have subscribed to a category,boards,topics. we have an API for getting the number of subscribers to a board.
boards/id/administration/${coreNode.id}/email/board

Similar way is there any API for gettting the List of  subscribers to a category and topics as well.

  • I think you can get everything you are looking for with API V2 subscriptions (khoros.com)

    So for a list of subscribers to a specific topic:

    SELECT subscriber FROM subscriptions WHERE target.type = 'thread' AND target.id = '[message id]'

    Count would be:

    SELECT count(*) FROM subscriptions WHERE target.type = 'thread' AND target.id = '[message id]'

    For a category instead of a topic:

    SELECT subscriber FROM subscriptions WHERE target.type = 'category' AND target.id = '[category id goes here]'

    And a complete url with encoding would look like this:

    https://[COMMUNITY DOMAIN]/api/2.0/search?q=SELECT%20subscriber%20FROM%20subscriptions%20WHERE%20target.type%20%3D%20%27thread%27%20AND%20target.id%20%3D%20%271387%27

     

    Or if you are doing this with FreeMarker I think it would look like this where ?url at the end encodes the url:

    <#assign subscribers = rest("2.0","/search?q=" + "SELECT subscriber FROM subscriptions WHERE target.type = 'thread' AND target.id = '1387'"?url) />

     

    • Akenefick's avatar
      Akenefick
      Genius

      Actually this won't work. Sorry. This only returns your subscriptions (the logged in user). So it appears it's not intended to be used this way at all.