I want to make an API call to do the above, in order to eliminate this currently manual step in the setup process.
I have malformed JSON when making the post call to the branch-restrictions API endpoint.
What should the desired JSON look like?
Almost exactly two years later to the day I have come back around to answer my own question.
Two Requests must be sent.
One for the delete...
curl -u ${BITBUCKET_USERNAME}:${BITBUCKET_PASSWORD} -X POST -H "Content-Type: application/json" -d '{
"kind": "delete",
"pattern": "master",
"branch_match_kind": "glob",
"type": "branchrestriction"
}' https://api.bitbucket.org/2.0/repositories/${BITBUCKET_WORKSPACE}/${BITBUCKET_REPO_SLUG}/branch-restrictions
One for the force...
curl -u ${BITBUCKET_USERNAME}:${BITBUCKET_PASSWORD} -X POST -H "Content-Type: application/json" -d '{
"kind": "force",
"pattern": "master",
"branch_match_kind": "glob",
"type": "branchrestriction"
}' https://api.bitbucket.org/2.0/repositories/${BITBUCKET_WORKSPACE}/${BITBUCKET_REPO_SLUG}/branch-restrictions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.