Skip to content

API should be able to order by merged_at field for merge_requests

Release notes

Enhancement for the merge_requests part of the API, so it is possible to order merge requests by the merge date (merged_at).

Problem to solve

For a review or to check in error cases when changes have been merged, i want a list of merge requests ordered by the time of merge (field merged_at). The documentation clearly states out, that order_by is only possible for created_at and updated_at: https://docs.gitlab.com/ee/api/merge_requests.html

So i cannot receive a sorted list, where the last merges are listed first and i can check chronological when merges were made.

Intended users

Find the source of an error by searching for the right merge request:

Find the merge request, which added a security flaw to the system:

User experience goal

Simplify integration of the API, so merge request listings can be directly used by personas mentioned above (e. g. in a Wiki or similar systems).

Proposal

Just add the merged_at to order_by parameter.

Availability & Testing

What does success look like, and how can we measure that?

GET /merge_requests?order_by=merged_at should return the list of merge requests in descending order with latest merge first

GET /merge_requests?order_by=merged_at&sort=asc should return the list of merge requests in ascending order with oldest merge first

Links / references

Edited by Daniel K.