Bitbucket Rest API error Something Went Wrong when requesting changes from a repository
Asked by bdbowen:

I am trying to get changes for a certain repository between certain dates. I am using the url:

<https://api.bitbucket.org/2.0/repositories/{workspace}/{repo-slug}/issues/{id}/changes?q=created_on> \>= 2021-06-21 AND created_on \<= 2021-06-28 AND user.uuid = {user uuid}

Every time I run this or a similar query I get an 500 Internal Server Error, "Something Went Wrong". If I remove any reference to created_on, then it works just fine, so I am not hitting my limits per hour (also I am using an authenticated request with OAuth credentials, so I shouldn't have a limit anyway).

Can anyone help me know what to do to fix this error? It seems to only be happening when using \>,\<,\>=, or \<= with created_on in just the issue/{issue_id}/changes endpoint because any other search criteria within the changes endpoint works, and any other endpoint, such as issues or issues/{issue_id}/comments, works with created_on and comparators.


Answers:
author: Theodora Boudale
body: Hi [@bdbowen](/t5/user/viewprofilepage/user-id/3360172),

When there is a 500 response from an API call there is usually an "id" in the response along with the message "Something went wrong".

Could you please post the value of the "id" from one of these calls, so I can check it in our system for further info?

Kind regards,  
Theodora

comments: author: bdbowen
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) I called it many times, and each time gave a distinct ID I noticed. Here is the value of one of the errors that I saved: "aa33d0a31f8e44e69f78bb5b2eed7567". I don't have any others of the ids because I didn't save them all.

At the time of this request I had moved on my testing to see if I could get an exact match, so I did a query for changes with just a uuid, and copied a time, then tried to see if it would allow me to search for an exact created_on. This was the URL that I requested that returned that error:

<https://api.bitbucket.org/2.0/repositories/{workspace}/{repo-slug}/issues/{issue-id}/changes?q=created_on=2021-06-25T21:52:30.254236> AND user.uuid = "{valid user uuid}"


author: Theodora Boudale
body: Hi [@bdbowen](/t5/user/viewprofilepage/user-id/3360172),

Thank you for the info.

This looks to be a bug with the endpoint, so I went ahead and created a bug report in our issue tracker:

* <https://jira.atlassian.com/browse/BCLOUD-21190>

I'm afraid that there is no workaround at the moment for this.

Our development team tracks bugs over there and will post an update on that bug report when this is fixed. Please note though that we don't provide ETAs and bug fixing is implemented as per our policy [here](https://confluence.atlassian.com/support/atlassian-cloud-bug-fix-policy-206865884.html).

You can add yourself as a watcher (by selecting the **Start watching this issue** link in the bug report) if you'd like to get notified via email on any updates. You can also select the **Vote for this issue** link to indicate you are affected by this issue.

If you have any further questions, please feel free to let me know.

Kind regards,  
Theodora


author: bdbowen
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) Thanks for your response. I found a non efficient work around for now. What I ended up doing is querying the issues that were updated on or created on a certain date, then going through the changes for each of those issues in a for each loop and filtering for if they were after the date. Because my assumption is that whenever a "change" is made to the issue, a change endpoint is added, but also the updated_on field of the issue itself is updated. Obviously not super effective in the long haul or with big O, but it works for now until this bug is fixed!


author: Dan Fraser
body: Hi [@bdbowen](/t5/user/viewprofilepage/user-id/3360172)

I'm a dev on the team which owns the **bbql** library. I've patched the issue this week, could you please confirm it's fixed your problem?

Edit: Sorry, we've had to hold off on the rollout of this. I'll continue to look into this next week.

Edit: The changes are live as of 3:00pm Sydney time 15th July. Feel free to give it a go [@bdbowen](/t5/user/viewprofilepage/user-id/3360172) and let us know if it's solved your problem!

Best regards,

Dan


author: bdbowen
body: [@Dan Fraser](/t5/user/viewprofilepage/user-id/4470731) It worked! Thanks so much!


Tags: api

bitbucket-cloud

change

cloud