REST endpoint to make repos public or private

Is there any REST endpoint to make repos and projects public or private?

Essentially looking for an automated way to accomplish this setting, and can't find it in REST API Docs.

Thanks,

3 answers

1 accepted

I found one api -

 

http://bitbucket.example/rest/api/latest/projects/{projectSlug}/repos/{repoSlug}  (PUT)

request payload- {public: true}.

It is documented here-

https://developer.atlassian.com/static/rest/bitbucket-server/4.6.1/bitbucket-rest.html#idp457424


If you try to make an repository public  from bitbucket-server UI , then do inspect element, and see UI is also calling this API only/




Hi Ed,

We have a way to do that through a permissions update script using ScriptRunner for Bitbucket Server.

You can also set it for all future by extending the repository creation event using our event handler too.

regards,

Mark.

He asked for REST endpoint, how this script gonna help ?

It's a viable answer while not directly answering the question we have scriptrunner installed and provides a method for accomplishing our larger task.

 

Thanks for the answers!!

Here's the catch if your project is public tweaking any repo to private will require the project to be private which in effect makes ALL repos private!

Another catch is if you tweak the project to private it has to stay private. Tweaking it back public after setting your repo private will reset the repo setting or make it public again.

Is there any way to differentiate this setting at the repo level.

Also what is the API endpoint for setting the project permission to private? It is not obvious from inspection as appears to use a class.

 

Thanks.

-Walt Shekrota

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,838 views 1 5
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you