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
https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/branch-restrictions
It looks like you're new here. Sign in or register to get started.