url = f"https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/branch-restrictions"
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
payload = json.dumps(
{
"type": "branchrestriction",
"kind": "push",
"branch_match_kind": "branching_model",
"branch_type": "development",
"users": [ALLOWED_USER], # ALLOWED_USER = "{asdf-asdf-asdf-asdf-asdf}"
}
)
response = requests.request(
"POST",
url,
data=payload,
headers=headers,
auth=(BBCLI_USERNAME, BBCLI_PASSWORD),
)The response I get is:
500
{'error': {'id': '8f1cbdfd520e48c8b362078b9420c139',
'message': 'Something went wrong'},
'type': 'error'}
This happens for repositories that don't have any branch restrictions set up and for ones that have some but not the rule I'm trying to set up.
Listing branch permissions works fine.
What's wrong with my request?