Get MR related data from Gitlab API

How to do:

  • Get all the commits in a specific merge request.
  • Get all users who made a request .
  • No. rows added / deleted / updated by a specific user in a merge request.

It is impossible to find how to use the Gitlab API ( http://doc.gitlab.com/ce/api/ ) to get all of the above. Is there a way that the Gitlab API can help get them directly or by introducing some kind of hack.

+6
source share
1 answer

For the first point, I think you are looking for this:

curl --header "PRIVATE-TOKEN: ****" "http://gitlab/api/v3/projects/:project_id:/merge_requests/:mr_id:/commits" 

The second point can be found with the attribute author

 curl --header "PRIVATE-TOKEN: ****" "http://gitlab/api/v3/projects/:project_id:/merge_requests/:mr_id: 

the last point is harder when you have a commit list you can get diff

 curl --header "PRIVATE-TOKEN: ****" "http://gitlab/api/v3/projects/:project_id:/repository/commits/:sha/diff 
+1
source

Source: https://habr.com/ru/post/974352/


All Articles