I've been trying to create a branch restriction rule using the API v2.0:
https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/branch-restrictions#post
I'm using python, and this is what my params and request look like:
data = {
"branch_match_kind" : "glob",
"kind" : "require_approvals_to_merge",
"type" : "branchrestriction",
"pattern" : branch,
"value" : str(br_approvals),
"users" : [],
"groups" : []
}
r = requests.post('https://api.bitbucket.org/2.0/repositories/' + user + '/' + repo_slug + '/branch-restrictions', auth=HTTPBasicAuth(user, password), data=data)It contemplates every mandatory field, including "value", which is why I don't understand why I keep getting the following error:
400
b'{"type": "error", "error": {"message": "malformed value"}}'
Can anyone shed some light on this?