Watching API

Hi,

I am reviewing the REST API documentation, and am wondering if there is a way to gather a list of users watching/following any given topic? I hope to gather this information after posting the webhook of a new actions on a topic.

Thanks

1 Like

Easiest way is probably the data explorer plugin and then How to run Data Explorer queries with the Discourse API. I doubt that there is an endpoint that provides that, so you’ll need to sort-of make one with data-explorer.

2 Likes

I had to look that up for a topic recently:

-- [params]
-- integer :topic_id

SELECT
    user_id,
    notification_level
FROM 
    topic_users
WHERE topic_id = :topic_id
AND notification_level > 1
ORDER BY notification_level DESC

The notification levels are here.

2 Likes

Just what I needed, thank you very much!

1 Like