gitlabgitlab-api

How to remove a reviewer in a merge request By API?


I can’t find any information in the GitLab documentation on how to remove one single reviewer by ID in a merd request. Has anyone encountered this problem?

I tried to do delete Requests by type:https://gitlab.com/projects/project_id/merge_requests/merge_request_id/reviewers/reviewer_id But unfortunately, it finds a list of all reviewers, but cannot find one by ID

Also tried using put request: https://gitlab.com/projects/project_id/merge_requests/merge_request_id/reviewers/reviewer_id&reviewer_ids=0

But then this request deletes ALL reviewers, and I need to somehow delete only one


Solution

  • I found a solution, everything turned out to be obvious. To make another put request Which will contain the ID reviewers that should remain and excluding those that need to be removed. For example, if we have two reviewers with ID 1 and 2, we need to remove the reviewer With ID 2 and leave the reviewer who has ID 1, then the request will be something like this:

    https://gitlab.com/projects/project_id/merge_requests/merge_request_id/reviewers/reviewer_id&reviewer_ids=1