Is there a way to turn on auto-unapprove with the REST API?

Dov Frankel August 8, 2019

I have a script to create new Bitbucket repos. It uses the /rest/api/1.0/projects/{projectKey}/repos endpoint with a request like this:

{
'name': project_name,
'scmId': 'git',
'forkable': True
}

 Is there another argument I can add, or a different API endpoint I can hit, to configure all new projects with the auto-unapprove setting turned on?

1 answer

0 votes
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 20, 2019

Hi @Dov Frankel ,

I might not be the best person to answer this question, however, I have found the following issue opened with the add-on developer: https://bitbucket.org/atlassian/stash-auto-unapprove-plugin/issues/25/api-documentation

In there I can read:

A key feature in this plugin is passing a payload of

{"unapproveOnUpdate": true}

to the REST API end point;

/rest/api/1.0/projects/PROJECT_KEY/repos/REPO_NAME/settings/pull-requests

This serves to set the flag so that all material changes to a PR to unapprove. Adding documentation of some of these endpoint will be useful for REST API users.


Therefore:

  1. You should be able to enable the plugin by sending  the payload "unapproveOnUpdate": true to the endpoint /rest/api/1.0/projects/PROJECT_KEY/repos/REPO_NAME/settings/pull-requests
  2. It might also work that you add the same payload when creating the new repository using the  /rest/api/1.0/projects/{projectKey}/repos endpoint

 

Just FYI, there are also the below 2 feature requests you might  be interested in:

 

Finally, in case of any other question or concern, you may want to create an issue with the add-on developer at: https://bitbucket.org/atlassian/stash-auto-unapprove-plugin/issues

 

Let me know if this helps.

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events