So, I wrote a small tool for exporting Pull Requests for review by company processes, and it was working fine up until a while back. All of a sudden, the API endpoint at /2.0/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/activity returns very few objects with "approval". It was working fantastic before, and my tool was able to grab the list of approvers and display who approved a pull request and when. Now, only a handful of issues have the activity approval present, which means it is impossible to display approvers and their approval dates through this endpoint.
So, my question is, is this an API change, or something that has happened on the specific organization I am trying to pull the activity from? I didn't find anything in the API docs about this changing, so as far as I can tell it should be working as expected, but it isn't.
Here is the documentation: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pullrequests/%7Bpull_request_id%7D/activity
2 suggestions
First
Increase the page length. The approvals might be there but on a pull request with lots of activity they might be on the second page of results, for example.
?pagelen=50
Or
Try filtering by approvals by adding this to your API call
?fields=values.approval
Here are the docs on partial responses: https://developer.atlassian.com/bitbucket/api/2/reference/meta/partial-response
If you filter by approvals you might not need to adjust the page length.
Hopefully that helps!
I am retrieving all available pages by following the URLs to the next page using the "next" field if it exists and terminating if it does not. There are also very few activity items on these pull requests, and the overall number has not increased since a a week ago. A significant number have 2 or 3 at most, and only 2 of those pull requests show up as having approval activity. Adding a 'pagelen' parameter also gives a 400 Bad Request error for the pullrequests endpoint, but a 'limit' parameter does not, which I am already using and is set to 500.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Grant Jennings , after more investigation. Our team has found a bug which affects older pull requests. We are working on a fix now. Thank you for your patience.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Grant Jennings .. following up on this. A fix has been deployed so you should be seeing approvals in the API as expected. Thank you for your patience and reporting the issue on the Community.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.