I have successfully created host repos using the 2.0 version of the API on Bitbucket Cloud.
The following is the curl command used.
curl -u username:password -X POST -H "Content-Type: application/json" -d '{"scm": "git", "is_private": "true"}' https://api.bitbucket.org/2.0/repositories/userspace/testreponame
However, using basically the same command string on Bitbucket v7.8.1 Server, I receive HTTP/1.1 404 errors. All I did is replace the domain name and add the project key.
curl -u username:password -X POST -H "Content-Type: application/json" -d '{"scm": "git", "is_private": "true", "project": {"key": "PROJ"}}' https://bitbucket.<domainname>.com/2.0/repositories/userspace/testreponame
What is the solution to this error? I can ping the host name. So it doesn't make sense why the curl error message reads: curl: Couldn't resolve host 'POST'.
Update: The "Couldn't resolve host 'POST' resolved by not using the git-bash shell. Instead, using CentOS 7 gnome-terminal. With that said, I haven't resolve the original issue. Still receiving the 404s. Maybe the <userspace> is not right? Cloud vs. Server versions are doing something different.