Forum Discussion

CarolineS's avatar
3 months ago
Solved

Subscriptions to a label?

Hi all,

I'm attempting to get the list of people who have subscribed to a label, but am struggling. The documentation is a bit confusing:

It says both that you have to use a community ID as the node.id constraint but also that you can give the node.id constraint as a board id? Seems conflicting. And, regardless of the documentation, I get an error when I try to use a board ID (such as node.id='board:wireless-lan' where wireless-lan is the id of the board)

My user has full admin permissions.

Any ideas? I am not really a developer (as is probably evident!), just trying to pull a few bits of data for a stakeholder.

Thanks!

  • I have been playing around for half an hour now and also only get subscriptions for the current user :( The target.id param seems to be always causing an error and therefor going against how it's documented even though it is returned in the resultset.

8 Replies

  • Claudius's avatar
    Claudius
    Boss
    1 month ago

    Wow! You're starting to fix this old a bug 😃 Looking forward to that shipping.

  • LucyL's avatar
    LucyL
    Khoros Staff
    1 month ago

    CarolineS​ a bit late on the response but the documentation is correct, this was a bug. It will be patched at tentatively at the patch at the end of the year.

    SELECT * FROM subscriptions shows data for the current user as this is the default filter.

    SELECT * FROM subscriptions WHERE target.type = 'label' AND target.id = 'userlabel1' AND node.id = 'Forum' this will get fixed.

  • CarolineS's avatar
    CarolineS
    Boss
    2 months ago

    Thank you Claudius​! That's what I'm seeing. So frustrating!

    Oh well. This particular request isn't super duper crazy important / not the end of the world if I can't get the label subscription info, but it's frustrating to have incorrect documentation / malfunctioning APIs!!

  • Claudius's avatar
    Claudius
    Boss
    2 months ago

    I have been playing around for half an hour now and also only get subscriptions for the current user :( The target.id param seems to be always causing an error and therefor going against how it's documented even though it is returned in the resultset.

  • CarolineS's avatar
    CarolineS
    Boss
    2 months ago

    nbalogh​ I am having this problem too. When I run the query as Peter suggested, I only get the label subscriptions of the user I'm logged in as. (this took me a minute... I run this query as a service user in postman and was getting empty results... once I "Switched user" to the service user and had them subscribe to a label, I got a result... but just for the one label that the service user subscribed to)

    peterlu​ any way around this to get ALL user label subscriptions?

  • nbalogh's avatar
    nbalogh
    Advisor
    2 months ago

    I might miss something, but for me this query only reports the labels I subscribed to, and I'm an admin. Any idea why?

  • CarolineS​ target.type can be 'label', node.id can be 'board:your-board-id', the issue is the target.id. There seems to be no way to find out the label id.
    But there is a work around. You can ignore target.id, the below query example can give you the subscribers of all labels within a board. The response JSON also contains the label info. You can then use Python or whatever language to filter out the label you are interested. You can use pagination to fetch all subscribers which involves multiple request calls.
    SELECT * FROM subscriptions where target.type='label' and node.id = 'board:HomeProducts' limit 100

    If you need a hand, I have developers to help you.