You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi,
I'm trying to get the Pull Requests between or after some specific date(s) and from a specific destination branch.
Eg: "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests/?q=created_on>"2023-04-09T00:00:00.000Z"&destination.branch.name="master"
For the above Query, I get the Pull Requests greater than "2023-04-09" but it includes all destination branches.
If I place "destination.branch.name" at the first place and then "created_on" parameter, then I get the Pull Requests from master branch but it doesn't filter by greater than specified created_on date.
Eg: "https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests/?q=destination.branch.name="master"&created_on>"2023-04-09T00:00:00.000Z"
It looks like only the first filter is accounted and then the remaining is ignored.
Any suggestion to resolve this issue is much appreciated.
Hello @Omraj Krishnamurthy
Thank you for reaching out to Atlassian Community!
If you would like to query for multiple parameters in your API call, you will need to use logical operators (AND, OR) between the different conditions, like in the following example:
curl -X GET -u username:app_password https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/pullrequests/?q=updated_on+%3E+2023-01-09T08%3A21%3A50%2B00%3A00+AND+destination.branch.name="test_branch"
which would translate to the following condition :
updated_on > 2023-01-09T08:21:50+00:00 AND destination.branch.name="test_branch"
The date and time values are encoded. Depending on the tool you are using to make the request, it might automatically encode it for you, but in case you would like to encode it manually you could use a third-party tool like https://www.urlencoder.org/.
You are also welcome to check for additional examples of querying for multiple conditions on the Bitbucket API - Filter and sort objects documentation.
Hope that helps! Let me know in case you have any questions.
Thank you, @Omraj Krishnamurthy !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Happy to have been of some help! Feel free to reach out to Atlassian Community in case you need help in the future :)
Thank you, @Omraj Krishnamurthy !
Patrik S
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.