Earlier I had asked a question about how to raise a pull request from command line and with help I came up with this code to get it done:
curl -k -X POST -H "Content-Type: application/json" --user username:password -d '{"title":"test","description":"test","fromRef":{"id":"branchone","repository":{"slug":"TrialRepo","name":null,"project":{"key":"~SS48647"}}},"toRef":{"id":"master","repository":{"slug":"TrialRepo","name":null,"project":{"key":"~SS48647"}}}}' https://url/bitbucket/rest/api/1.0/projects/~SS48647/repos/trialrepo/pull-requests
The thing is this code will run in production environment and username and password can't be plain-texted.
I was thinking if it'd be possible to use SSH Keys for user-authentication. I will generate keys on a unix machine and I will add the public key to Bitbucket. Please add your views on how to get this done. Also, if there's a better way to avoid plain-texted user-authentication it'd be great. Thanks