Have figured out how to GET the specific pull request page into json, and then into a hash, and the link for {'links'}{'diff'}{'href'} is a URL which I then tried to GET. Unfortunately, I believe the bitbucket backend generates a unique page off of that, and then re-directs to it. A nightmare if you need the content of that newly minted page with a unique id in the URL, impossible to anticipate. Sigh. If I can get that, I can parse to my heart's content, but I have to get that page in the first place. Help?
After a long fruitless search, I finally found that curl has a -L parameter which will follow redirects. Noticed that no one else had a solution for this either. (Bitbucket - there is a need for this to be an API call...)
So this will give you the diff page:
my @results = `curl -L -D- -X GET -H "Authorization: Basic <your credentials here>" -H "Content-Type: application/json" https://bitbucket.org/!api/2.0/repositories/<repo>/pullrequests/<pull request number>/diff`; # backticks used here to run as a shell command
The @results array will need to be parsed six ways from Sunday from here, but that's half the fun.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.