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

trying to set the repository generate by api as private is_private : true with no success

Edited

Hi Guys

trying to set the repository generate by api as private

is_private : true  with no success ... im using OAUTH .... 

tried to create repo and update (post and put) with no success 

with POST

curl --request POST \
--header 'Authorization: Bearer ${token}' \
--header 'Accept: application/json' \
--data '{ "scm": "git", "is_private": "true" }'

with PUT

curl --request PUT \
--header 'Authorization: Bearer ${token}' \
--header 'Accept: application/json' \
--data '{ "scm": "git", "is_private": "true" }'

 

I see that there is already question on this with no answer ...

https://community.atlassian.com/t5/Bitbucket-questions/How-to-create-private-repository-via-API-2-0/qaq-p/1202924

 

Thanks Eyal

 

1 answer

1 accepted

0 votes
Answer accepted
Norbert C Atlassian Team Jan 10, 2022

Hi @Eyal David ,

It's Norbert here from the other Community question :)

I would like to inform you the reason why the repository creation is failing is because the "-H "Content-Type: application/json" flag is missing from your call. This flag is needed as we need to specify the content type. 

Can I ask you to do an API call like this and let me know if it creates you a private repository?

curl -X POST -H "Authorization: Bearer token" https://api.bitbucket.org/2.0/repositories/workspace/reposlug -H "Content-Type: application/json" -d '{"scm": "git", "is_private": true, "fork_policy": "no_public_forks"}'

 Please let me know how it goes, Eyal.

Best Regards,
Norbert
Atlassian Bitbucket Cloud Support

@Norbert C Thank you very much worked like a charm !!!

Norbert C Atlassian Team Jan 13, 2022

You're welcome, I'm glad to hear I was able to help :)

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...

172 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