Skip to content

API end point /api/v4/projects/:id/merge_requests doesn't filter results if we set view=simple

Summary

When making an API request to the end point /api/v4/projects/:id/merge_requests the query parameter view=simple doesn't work. The API request always returns the complete response for each result.

However, as per the documentation, when using view=simple we should get a filtered response.

https://docs.gitlab.com/ee/api/merge_requests.html#list-merge-requests

This bug was raised by a Premium Customer (Internal Link) (All GitLab Team Member can view Support Tickets)

Steps to reproduce

  • Try making a API request to the API end point /api/v4/projects/:id/merge_requests with and without query parameter view=simple and observe the output.
  • For testing, try using the below API (test project in gitlab-gold) call using an Admin account
https://gitlab.com/api/v4/projects/34525535/merge_requests?state=merged&view=simple

Example Project

Project: https://gitlab.com/gitlab-gold/azhar/test_mr_api/

What is the current bug behavior?

  • The API response always returns full result despite setting view=simple

What is the expected correct behavior?

  • The API response should limit the result details when using view=simple

Relevant logs and/or screenshots

Output of checks

This bug happens on GitLab.com (14.10.0-pre 542c19be)

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by Emily Chang