Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP/1.1 404 when using the POST method creating new Bitbucket repos

tekknj214 April 28, 2021

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.

2 answers

1 accepted

0 votes
Answer accepted
tekknj214 April 28, 2021

While looking for one answer, I discovered two. Question, why must the format of the command have to be different between the two versions of the API. Very confusing.

This part of the command string is same between the two API versions:
curl -u username:passowrd POST -H "Content-Type: application/json"

The values in the <...> brackets are the user defined variables.

API v2.0 which I used with Bitbucket Cloud
-d '{"scm": "git", "is_private": "true", "key": "<projectkey>"}' \
https://api.bitbucket.org/2.0/repositories/<userspace>/reponame

API v1.0 which I used with Bitbucket Server v7.8.1
-d '{"name": "<reponame>", scm": "git", "is_private": "true", "key": "<projectkey>"}' \
https://bitbucket.<domainname>.com/rest/api/1.0/projects/<projectkey>/repos

0 votes
tekknj214 April 28, 2021

.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events