You may use the REST-API for this:
https://developer.atlassian.com/static/rest/bitbucket-server/4.4.1/bitbucket-rest.html#idp3238992
It looks like you're new here. Sign in or register to get started.