3

From my Java application, I need to programmatically access Atlassian BitBucket account in order to be able to manage repositories/branches/commits/files.

I have found the following Java API https://developer.atlassian.com/server/bitbucket/reference/java-api/ but unable to find any example how it can be used /

Could you please show a simple example how to programmatically login with user credentials into Atlassian BitBucket account and fetch for example a list of files inside of specific repository?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
alexanoid
  • 24,051
  • 54
  • 210
  • 410

1 Answers1

2

If I understand your scenario right, you want to execute code on the server and not through the rest api?

Code running on the server is communication through the java-api and needs no authentication in order to execute tasks. There are plenty of examples on how to build a java plugin on your atlassian server: https://docs.atlassian.com/bitbucket-server/docs/5.6.2/how-tos/creating-a-bitbucket-server-plugin.html. This guides walks you through how to build and upload your java plugin. However, in order to get your code running you probably need a "Hook event" such as push request or similar. You simply connect the hook event to your plugin and perform the actions you which to do.

Most of the things you can do through the rest API, I would recommend the stashy 0.3 library which is available https://pypi.python.org/pypi/stashy/0.3

Stashy makes it easy to connect both by simple auth and oAuth. I hope I answered some of your questions, pelase dont hesitate to ask more specific questions.

Oskar Granlund
  • 399
  • 1
  • 4
  • 9