Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,294,705
Community Members
 
Community Events
165
Community Groups

Unable to authenticate to manipulate Workflow Hooks via API in ScriptRunner

I've got over 500x projects and trying to enforce enablement of hooks across all of them.

Have found the APIs required to retrieve, and make the necessary manipulation.
https://docs.atlassian.com/bitbucket-server/rest/6.10.0/bitbucket-rest.html#idp374

However, I am facing 401 error when running within ScriptRunner. I know my user has the permission as I am able to reach the https://********/rest/api/1.0/projects/TEST/settings/hooks endpoint directly through my browser.

I read into Application Links and understood it to be a means to authenticate into other atlassian suite of projects (i.e. Bitbucket -> Jira/Confluence/Etc). In my particular case, am intending to execute the ScriptRunner scripts within Bitbucket to manipulate bitbucket settings.

Any help would be appreciated! Thanks.

1 answer

Hi @Sean Lim ,

Thank you for your post.

As you are trying to access details about the native Bitbucket Hooks from within a ScriptRunner for Bitbucket script, you can bypass the REST API altogether and access the Bitbucket Java API directly.

For example, here is the documentation for the RepositoryHookService: https://docs.atlassian.com/bitbucket-server/javadoc/7.19.1/api/com/atlassian/bitbucket/hook/repository/RepositoryHookService.html

If you also provide an example of your script, I might be able to help further?

Kind regards,

Robert Giddings,

Product Manager, ScriptRunner for Bitbucket

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,159 views 2 9
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you