Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Edited

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

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

185 views 2 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you