Hi all. My team has tens of developers managing hundreds of repos with lots of branches, and we expect to receive email notifications on pushes for all branches.
Manually selecting a repo, clicking on watch and configuring it is inefficient when considering lots of repos.
There seems to be an API for that: (https://developer.atlassian.com/server/bitbucket/rest/v906/api-group-repository/#api-api-latest-projects-projectkey-repos-repositoryslug-watch-post).
However, using this service does not turn the repo icon "watch" into "watching" (as it would do when using the web interface), the documentation does not tell how to specify which set of branches to watch, and the repo does not show up in the user profile under "watched repositories".
The body for this POST request does not seem aligned with what needs to be provided in the web page.
Is it actually possible to programmatically set "watch/pushes/all branches" for a repo?
With this, we would script a loop over relevant collections of repos and be efficient at configuring Bitbucket.
Regards
Daniel Villeneuve
Finally, I've found the following HTTP service: PUT /rest/notification/latest/watch/projects/$project/repos/$repo with the following JSON body:
{ "pushNotificationScope": "ALL", "pullRequestNotificationScope": "ALL" }
where other possible values are "NONE", and "DEFAULT_BRANCH" for push and "STATE_CHANGES" for pull.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.