Change settings with REST API
API
Webhook to Jenkins hook settings can be updated via the Atlassian Bitbucket API via the following endpoint:
/rest/api/latest/projects/{0}/repos/{1}/settings/hooks/com.nerdwin15.stash-stash-webhook-jenkins:jenkinsPostReceiveHook/enabled
For more on the Bitbucket REST API for updating and changing hooks, read here.
We've created a sample python script to automate updating settings. It reads in a settings.json file which you can download here or below.
To change the webhook source, add jenkinsEndPointType to the json setting with one of the following values:
Bitbucket Branch Source Plugin | com.nerdwin15.stash.webhook.notifier.BitbucketSourceNotifier |
Git Plugin | com.nerdwin15.stash.webhook.notifier.GitPluginNotifier |
Direct Jobs Trigger | com.nerdwin15.stash.webhook.notifier.DirectJobsNotifier |
Example scripts
Parameter details
disabledEvents
is a comma-separated list of class names of events to ignore. Supported class names are listed below, with links to the corresponding Bitbucket documentation explaining when each event is triggered:
com.atlassian.bitbucket.event.repository.RepositoryRefsChangedEvent
com.atlassian.bitbucket.event.mirror.RepositoryMirrorSynchronizedEvent
Need support? Create a request with our support team.