Member-only story
Bitbucket
Use Bitbucket API for managing projects
It’s a convenient way for doing repetitive tasks for collecting information about the repositories, commits, branches ..
Bitbucket API now has REST API version 2.0 but in this post, we will go with version 1.0 since I do not have bitbucket server for version 2.0 now. But it’s ok. The idea is showing you guys some functionalities that Bitbucket API supports.
First, to be able to retrieve sensitive data about projects, you will need the access token. The access token you can get from the user profile settings in Bitbucket site.
There are some role with token specific to your needs : admin / read / write. In this example I’m using admin role.
- Get all repositories in a project
METHOD: GET
PATH: https://{server_name}/rest/api/1.0/projects/{project_name}/repos
AUTHORIZATION: Bearer + {token}
- Get commits in a repository
METHOD: GET