How do I change a project from public to private via the Bit Bucket REST API?

John Lawlor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 13, 2018

I am trying to change visibility of a project in Bit Bucket from 'Public' to 'Private'. I can't see how to do this using the Bit Bucket REST API.

1 answer

1 accepted

1 vote
Answer accepted
Caterina Curti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 19, 2018

Hi @John Lawlor,

To change the visibility of a project in Bitbucket Server, you can use the PUT method of the /rest/api/1.0/projects/{projectKey} end point.

 

Here is an example using a curl command:

curl --user <username>:<password> -k -H "Content-Type: application/json" --data '{"public":false}'  -X PUT <Bitbucket URL>/rest/api/1.0/projects/<project key>

The data is what is changing the visibility of the repository from the current setting to false.

 

curl --user <username>:<password> -k -H "Content-Type: application/json" --data '{"public":true}'  -X PUT <Bitbucket URL>/rest/api/1.0/projects/<project key>

By replacing false with true, you can set the visibility to public.

 

In both examples, you will need to provide a valid username and password and the URL for Bitbucket Server.

 

Cheers,

Caterina - Atlassian

John Lawlor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2018

Thanks Caterina!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events