Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Eyal David January 9, 2022

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
Atlassian Team members are employees working across the company in a wide variety of roles.
January 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

Eyal David January 10, 2022

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

Norbert C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 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
AUG Leaders

Atlassian Community Events