Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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 Pipelines

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

746 views 15 10
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