Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

"approval" objects suddenly missing from Pull Request Activity API

Grant Jennings
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 10, 2020

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
Atlassian Team members are employees working across the company in a wide variety of roles.
December 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!

Grant Jennings
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 11, 2020

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.

Tyler T
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 14, 2020

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
Atlassian Team members are employees working across the company in a wide variety of roles.
December 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
AUG Leaders

Atlassian Community Events