Forum Discussion

tyw's avatar
tyw
Boss
5 years ago

Count # of members subscribed to a topic?

If my understanding is correct this call will let me see which members are subscribed to a discussion board.

E.g of 500 community members, 30 have subscribed to get a notification whenever activity occurs on this board. 

 

https://community.DOMAIN.com/restapi/vc/boards/id/BOARD-ID/subscribers/email/board/

 

Is there a way to do this for a specific topic however?  Identify who, and the total count of members subscribed to a topic?

15 Replies

  • Hello Bparra 

    Could you clarify if you are interested in obtaining board subscriptions or subscriptions to individual messages/threads?

     
  • Is there a way to get board subscriptions by using the same format mentioned above? 

    "Count of subscribers: 
    SELECT count(*) FROM subscriptions WHERE target.type = 'thread' AND target.id = '2250'

    Subscribers: 
    SELECT subscriber FROM subscriptions WHERE target.type = 'thread' AND target.id = '2250'"

  • tyw 

    Unfortunately yes, this API is only designed to do stuff for the current users subscriptions (or another user if you pass subscriber.id='xx') and is unable to do a global count of subscribers to a node. 

     

  • tyw's avatar
    tyw
    Boss
    5 years ago

    Thanks Claudius 

    I suspect user error on my part but this doesn't appear to be working for me. 

    If i subscribe using a test account the result doesn't change, I am show '1' as the result in count query, the details query just shows my details (the 1 account I assume)?

    I am changing the targetid of course so I'm not sure what I am doing wrong. 

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

    • Shows the result of '1' despite subbing from other test accounts.

    SELECT subscriber FROM subscriptions WHERE target.type = 'thread' AND target.id = '2250'

    • Results in my details being shown only; I know another account is subscribed however. I am logged in as the Admin here. 
  • You can supply the thread id when querying API v2's "subscriptions" collection:

    Count of subscribers: 
    SELECT count(*) FROM subscriptions WHERE target.type = 'thread' AND target.id = '2250'

    Subscribers: 
    SELECT subscriber FROM subscriptions WHERE target.type = 'thread' AND target.id = '2250'