Gitlab API to Get Merge Request Comments and Reviews

Hi there, I have a problem regarding the Gitlab API

I’m doing an automation robot for my gitlab project which aims to automatically collect all the reviews and comments of the recent Merge Requests, and so far I have gone through the Gitlab Merge Request API and there seems to be no related one. Anyone has a good advice on this or has had the same problem?

Thanks for taking the time to be thorough in your request, it really helps! :blush:

1 Like

Hi,

According to merge request API docs: Merge requests API | GitLab

Comments are done by the notes API command, so:

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

hope that is what you are looking for.

Hi, thanks for this, but actually I have tried notes api, as well as the discussions api, and I just find out both of them can only grab information about the merge request discussions and activities like when you comment on the whole MR, not for single line of code. However, generally we do code review line by line and leave comments to some lines of codes, and this action seems to be unavailable to these 2 APIs :sob: .

Have you tried to get comments for some pieces of code, not for the entire MR? Any other suggestions?

1 Like

Hi… I suggest a reverse engineering of gitlab javascript. Just open your network in your console browser and take a look how gitlab does the POST when you comment over the lines.

I found what I need in order to create merge-request to projects we split in multiple repositories. See my reply in: How to move merge-request between projects? - #4 by amadeubarbosa Maybe could inspire you.