Can I update (add to) "allowed_users" of a topic via an API call?

I’d like to be able to add users to “allowed_users” of a topic. When I retrieve a topic, one section is details.allowed_users. Is there a way to add additional users here with a PUT?

Yes you can.

https://github.com/discourse/discourse/blob/master/spec/models/topic_spec.rb#L495-L496

As per above code I am sure by inviting you can add any user to allowed_users list.

4 Likes

I apologize, my ruby experience is fairly limited - can you give me a pointer on how to infer the needed API call to do that? Not asking anyone to do it for me, but maybe a pointer?

bump Anyone know if this is possible via the existing API?

You can use this endpoint to invite a user to a topic.

POST https://discourse.example.com/t/{id}/invite
BODY "username": "string"

If you are using the ruby discourse_api gem you can use this method: invite_user_to_topic

https://github.com/discourse/discourse_api/blob/master/examples/invite_users.rb#L12

4 Likes