Extract data that Jenkins receives from POST hooks sent by eg. github or bitbucket

hookJenkins

I have a Jenkins job Trigger builds remotely (e.g., from scripts), and bitbucket PULL request HOOK triggers that job we can say everything works fine.

Jenkins is smart to check any change and build them.

On each build there is data that is changed and is sent in json format.

Is there a way to extract that data sent by hooks to Jenkins while using buld trigger already mentioned?

Best Answer

I'm not sure how to achieve your goal from BitBucket side, but for every job in Jenkins, there are metadata parameters which you can check by going to a link which looks like that:

http://your-ci-server/job_name/build_number/api/json

Example: https://lel.doesntexist.com/job/geek-kb/job/scripts/job/declarative_pipeline_test/2/api/json