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

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

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

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.

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 Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

630 views 0 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot