Branch restrictions

Update a branch restriction rule

Changed on

Updates an existing branch restriction rule.

Fields not present in the request body are ignored.

See POST for details.

put/repositories/{workspace}/{repo_slug}/branch-restrictions/{id}

Request

  • Base URL
    https://api.bitbucket.org/2.0
  • URL
    https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/branch-restrictions/{id}
  • Auth
    • OAuth 2
      Authorization code: https://bitbucket.org/site/oauth2/authorize
      Token URL: https://bitbucket.org/site/oauth2/access_token scopes: repository:admin
    • or HTTP basic
    • or API key in header Authorization

Request body

typestring required
idinteger

The branch restriction status' id.

kind'push' | 'delete' | 'force' | 'restrict_merges' | 'require_tasks_to_be_completed' | 'require_approvals_to_merge' | 'require_review_group_approvals_to_merge' | 'require_default_reviewer_approvals_to_merge' | 'require_no_changes_requested' | 'require_passing_builds_to_merge' | 'require_commits_behind' | 'reset_pullrequest_approvals_on_change' | 'smart_reset_pullrequest_approvals' | 'reset_pullrequest_changes_requested_on_change' | 'require_all_dependencies_merged' | 'enforce_merge_checks' | 'allow_auto_merge_when_builds_pass' | 'require_all_comments_resolved' required

The type of restriction that is being applied.

branch_match_kind'branching_model' | 'glob' required

Indicates how the restriction is matched against a branch. The default is glob.

branch_type'feature' | 'bugfix' | 'release' | 'hotfix' | 'development' | 'production'

Apply the restriction to branches of this type. Active when branch_match_kind is branching_model. The branch type will be calculated using the branching model configured for the repository.

patternstring required

Apply the restriction to branches that match this pattern. Active when branch_match_kind is glob. Will be empty when branch_match_kind is branching_model.

pipelines_source_branchesstring[]

List of source branch names allowed to push back to the restricted branch. Used in conjunction with pipeline-based restrictions.

valueinteger

Value with kind-specific semantics:

  • require_approvals_to_merge uses it to require a minimum number of approvals on a PR.

  • require_default_reviewer_approvals_to_merge uses it to require a minimum number of approvals from default reviewers on a PR.

  • require_passing_builds_to_merge uses it to require a minimum number of passing builds.

  • require_commits_behind uses it to require the current branch is up to a maximum number of commits behind it destination.

Response

The updated branch restriction rule

typestring required
idinteger

The branch restriction status' id.

kind'push' | 'delete' | 'force' | 'restrict_merges' | 'require_tasks_to_be_completed' | 'require_approvals_to_merge' | 'require_review_group_approvals_to_merge' | 'require_default_reviewer_approvals_to_merge' | 'require_no_changes_requested' | 'require_passing_builds_to_merge' | 'require_commits_behind' | 'reset_pullrequest_approvals_on_change' | 'smart_reset_pullrequest_approvals' | 'reset_pullrequest_changes_requested_on_change' | 'require_all_dependencies_merged' | 'enforce_merge_checks' | 'allow_auto_merge_when_builds_pass' | 'require_all_comments_resolved' required

The type of restriction that is being applied.

branch_match_kind'branching_model' | 'glob' required

Indicates how the restriction is matched against a branch. The default is glob.

branch_type'feature' | 'bugfix' | 'release' | 'hotfix' | 'development' | 'production'

Apply the restriction to branches of this type. Active when branch_match_kind is branching_model. The branch type will be calculated using the branching model configured for the repository.

patternstring required

Apply the restriction to branches that match this pattern. Active when branch_match_kind is glob. Will be empty when branch_match_kind is branching_model.

pipelines_source_branchesstring[]

List of source branch names allowed to push back to the restricted branch. Used in conjunction with pipeline-based restrictions.

valueinteger

Value with kind-specific semantics:

  • require_approvals_to_merge uses it to require a minimum number of approvals on a PR.

  • require_default_reviewer_approvals_to_merge uses it to require a minimum number of approvals from default reviewers on a PR.

  • require_passing_builds_to_merge uses it to require a minimum number of passing builds.

  • require_commits_behind uses it to require the current branch is up to a maximum number of commits behind it destination.

Changes

    • info

      added the new optional request property /

    • info

      added the optional property / to the response with the status

    • info

      added the new optional request property //////

    • info

      added the optional property ////// to the response with the status