On Thu, May 02, 2019 at 02:52:27PM +0100, Milosz Wasilewski wrote:
Hi,
There is a request to allow managing email subscriptions when creating projects via REST API. Right now there is no such option. I took a quick look at the REST API code and I can see 2 options:
- expose Subscription objects to the API
This would be the easiest option as privileged users would be able to add/remove/modify the objects. This comes at a cost however as it would expose usernames and email addresses of our users.
- add "subscribe" endpoint to Project
The path would be like /api/projects/<id>/subscribe This would be a POST call with only email address included. If the user with such email address is already in the database it would be subscribed to the project notifications. If there isn't a user, email address only would be subscribed. This remove the risk of exposing users and emails. We would probably also need 'unsubscribe' endpoint in such scenario.
I lean towards option 2. If there are other suggestions I'm keen to hear them.
2. looks better to me as well, however it's possible to have 1. and make the list of subscriptions non-public, i.e. we can make only the project admins have access to the full list of subscriptions.