-
Type:
Suggestion
-
Resolution: Unresolved
-
Component/s: API Framework - Querying, Pull Request - View / Diff
-
None
Problem Definition
The pullrequests API endpoint returns the field closed_on when the parameter
fields=*.*
is used, e.g.
https://api.bitbucket.org/2.0/repositories/<workspace-id>/<repo>/pullrequests?fields=*.*&q=state+%3D+%22MERGED%22
It is not possible at the moment to filter pull requests based on this field. Using a URL like the following
https://api.bitbucket.org/2.0/repositories/<workspace-id>/<repo>/pullrequests?fields=*.*&q=state+%3D+%22MERGED%22+AND+closed_on+%3E+2023-06-05T14%3A00%3A00-07%3A00
will return a 500 code:
{
"type": "error",
"error": {
"message": "Something went wrong",
"id": "5058bb101ed24efd8c9cd1138ba03630"
}
Using a URL like the following
https://api.bitbucket.org/2.0/repositories/<workspace-id>/<repo>/pullrequests?fields=*.*&q=state+%3D+%22MERGED%22+AND+values.closed_on+%3E+2023-06-05T14%3A00%3A00-07%3A00
returns
{
"type": "error",
"error": {
"message": "Field \".values.closed_on\" does not support filtering"
}
}
Suggested Solution
Support filtering by the closed_on field in the pullrequests API endpoint.
Workaround
Filtering could be done on the client side with a tool that filters JSON data.