I use documentation
https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D
to create my repo vi REST API 2.0.
Sent request and got new repo.
curl -X POST -H "Content-Type: application/json" -u 'user:password' -d '{"scm": "git", "project": {"key": "ABC"}, "fork_policy": "no_public_forks", "is_private": "true", "description": "blabla"}' https://api.bitbucket.org/2.0/repositories/teamname/reponame
But "mainbranch": null in this case. It need it to be "master" by default.
I also sent request, where I specified mainbranch, but still got "mainbranch": null in result.
curl -X POST -H "Content-Type: application/json" -u 'user:password' -d '{"scm": "git", "project": {"key": "ABC"}, "fork_policy": "no_public_forks", "is_private": "true", "mainbranch": {"type": "branch", "name": "master"}, "description": "blabla"}' https://api.bitbucket.org/2.0/repositories/teamname/reponame
What am I doing wrong? How can I specify main branch while creating repo?