Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

"approval" objects suddenly missing from Pull Request Activity API

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.

1 answer

1 accepted

2 votes
Answer accepted
Tyler T Atlassian Team Dec 11, 2020

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.

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.

Like Grant Jennings likes this
Tyler T Atlassian Team Dec 16, 2020

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.

Like Grant Jennings likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,753 views 10 16
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you