How do you get the name of the user who made the Push?

Ashley Sommer August 30, 2016

This question is in reference to Atlassian Documentation: POST service webhook for Bitbucket Server

The documentation for POST service webhook for Bitbucket Server, mentions in more than paragraph, that the JSON payload contains "the name of the user that made the push". However in the sample JSON extract, there is no reference to the user who made the push. How do I get that information fro the POST payload?

1 answer

1 vote
ThiagoBomfim
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 30, 2016

Hi Ashley,

On the page you mentioned the user is listed. Have a look at this part:

"toCommit":{
               "id":"f259e9032cdeb1e28d073e8a79a1fd6f9587f233",
               "displayId":"f259e90",
               "author":{
                  "name":"jhocman",
                  "emailAddress":"jhocman@atlassian.com"
               }

The "Author Name" of the commit it is moving to in this sample case is jhocman.

Best regards,
Thiago Bomfim
DevTools

Ashley Sommer August 30, 2016

Hi Thiago,

Thanks for your reply, however I believe it doesn't answer my question.

The user `jhocman` in this case is the author of the commit it is moving to, not necessarily the user who made the push to bitbucket. Does that make sense?

For example my friend James could make three commits, then I could push those commits to bitbucket. In the JSON it will show the author of the `toCommit` as 'James' however I need a way to find out that 'Ashley' made the push to bitbucket.

ThiagoBomfim
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 11, 2016

Hi Ashley,

Sorry for the late response. Got it now. Usually what I said will be the case, but you're right in saying that a user could be pushing commits s/he didn't author. If you want more detailed information on the commit ref changes (i.e. push), you can look into the database in the sta_push_ref. 

The complete query with all the tables you need to join is on this KB:

I hope that helps.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events