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

REST endpoint to make repos public or private

Ed Quail May 23, 2016

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

1 vote
Answer accepted
VivekS May 23, 2016

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/




kiran jonnalagadda June 27, 2019

@VivekS can you elaborate this, how you have used inspect element to change to public ?

2 votes
Mark McCormack (Adaptavist)
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.
May 24, 2016

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.

VivekS May 24, 2016

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

Ed Quail May 25, 2016

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

0 votes
wshekrot June 8, 2016

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
TAGS
AUG Leaders

Atlassian Community Events