GitLab APIでそのMerge Requestの変更内容を取得する

## 公式

https://docs.gitlab.com/ee/api/

### サンプル
```
curl "https://gitlab.example.com/api/v4/projects"
```

#### HTTP response付

```
curl --include "https://gitlab.example.com/api/v4/projects"
```

#### 終了コード付

```
curl --fail "https://gitlab.example.com/api/v4/does-not-exist"
curl: (6) Could not resolve host: gitlab.example.com
```

#### Project ID と、MR から変更内容取得

Project ID:

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/93824/bbcdef24-1ad3-24c0-56cc-d51eb5691f13.png)

MR: https://gitlab.com/e99h2121/my-sample-gitlab/-/merge_requests/30

で、以下で変更内容が取得できる

```
curl --include "http://gitlab.com/api/v4/projects/28155327/merge_requests/30/changes"
```


## 参考記事

https://qiita.com/tsuyuzaki@github/items/69e16adda6492c509014

https://qiita.com/kenji-yokoi/items/b29391e654ccba8ca297



## その他

以下など行うと、

```
curl "https://gitlab.com/api/v4/projects"
```

ごっそり返ってくる。

```
[{"id":30301520,"description":"","name":"provaJava","name_with_namespace":"Luiz Gustavo Freitas Carvalho / provaJava","path":"provajava","path_with_namespace":"luiz.carvalho4/provajava","created_at":"2021-10-08T23:55:22.729Z","default_branch":"main","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:luiz.carvalho4/provajava.git","http_url_to_repo":"https://gitlab.com/luiz.carvalho4/provajava.git","web_url":"https://gitlab.com/luiz.carvalho4/provajava","readme_url":null,"avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:55:22.729Z","namespace":{"id":13162171,"name":"Luiz Gustavo Freitas Carvalho","path":"luiz.carvalho4","kind":"user","full_path":"luiz.carvalho4","parent_id":null,"avatar_url":"https://secure.gravatar.com/avatar/44d74b32ee2ccd952d8f29f71889e4f3?s=80\u0026d=identicon","web_url":"https://gitlab.com/luiz.carvalho4"}},{"id":30301519,"description":"","name":"Wmic","name_with_namespace":"Widya Walesa / Wmic","path":"wmic","path_with_namespace":"w41l/wmic","created_at":"2021-10-08T23:55:18.596Z","default_branch":"main","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:w41l/wmic.git","http_url_to_repo":"https://gitlab.com/w41l/wmic.git","web_url":"https://gitlab.com/w41l/wmic","readme_url":null,"avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:55:18.596Z","namespace":{"id":416227,"name":"Widya Walesa","path":"w41l","kind":"user","full_path":"w41l","parent_id":null,"avatar_url":"https://secure.gravatar.com/avatar/307cfff3afcb7afd9ff7d29e554a511f?s=80\u0026d=identicon","web_url":"https://gitlab.com/w41l"}},{"id":30301509,"description":"","name":"Exercice2","name_with_namespace":"ZHANG Yang / Exercice2","path":"exercice2","path_with_namespace":"TheRustSword/exercice2","created_at":"2021-10-08T23:53:00.064Z","default_branch":"master","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:TheRustSword/exercice2.git","http_url_to_repo":"https://gitlab.com/TheRustSword/exercice2.git","web_url":"https://gitlab.com/TheRustSword/exercice2","readme_url":"https://gitlab.com/TheRustSword/exercice2/-/blob/master/README.md","avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:53:00.064Z","namespace":{"id":13647034,"name":"ZHANG Yang","path":"TheRustSword","kind":"user","full_path":"TheRustSword","parent_id":null,"avatar_url":"https://secure.gravatar.com/avatar/75c753ebb2d1290f053108becac6f600?s=80\u0026d=identicon","web_url":"https://gitlab.com/TheRustSword"}},{"id":30301493,"description":"","name":"FE","name_with_namespace":"Vic C / FE","path":"fe","path_with_namespace":"cekvenich2/fe","created_at":"2021-10-08T23:50:50.669Z","default_branch":"main","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:cekvenich2/fe.git","http_url_to_repo":"https://gitlab.com/cekvenich2/fe.git","web_url":"https://gitlab.com/cekvenich2/fe","readme_url":"https://gitlab.com/cekvenich2/fe/-/blob/main/README.md","avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:50:50.669Z","namespace":{"id":13655634,"name":"Vic C","path":"cekvenich2","kind":"user","full_path":"cekvenich2","parent_id":null,"avatar_url":"https://secure.gravatar.com/avatar/7af7bf7c69b1af999254487afc10a95b?s=80\u0026d=identicon","web_url":"https://gitlab.com/cekvenich2"}},{"id":30301491,"description":"file public\r\n","name":"file-kodular-melingkar","name_with_namespace":"Warsito Warsito / file-kodular-melingkar","path":"file-kodular-melingkar","path_with_namespace":"namawarsito/file-kodular-melingkar","created_at":"2021-10-08T23:50:44.432Z","default_branch":"main","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:namawarsito/file-kodular-melingkar.git","http_url_to_repo":"https://gitlab.com/namawarsito/file-kodular-melingkar.git","web_url":"https://gitlab.com/namawarsito/file-kodular-melingkar","readme_url":null,"avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:50:44.432Z","namespace":{"id":4356029,"name":"Warsito Warsito","path":"namawarsito","kind":"user","full_path":"namawarsito","parent_id":null,"avatar_url":"https://secure.gravatar.com/avatar/c4a4d4b0d3983ef2968bef637b7655e8?s=80\u0026d=identicon","web_url":"https://gitlab.com/namawarsito"}},{"id":30301481,"description":null,"name":"Phantom99","name_with_namespace":"RaameshB / Phantom99","path":"Phantom99","path_with_namespace":"RaameshB/Phantom99","created_at":"2021-10-08T23:49:33.127Z","default_branch":"PhantomCode","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:RaameshB/Phantom99.git","http_url_to_repo":"https://gitlab.com/RaameshB/Phantom99.git","web_url":"https://gitlab.com/RaameshB/Phantom99","readme_url":"https://gitlab.com/RaameshB/Phantom99/-/blob/PhantomCode/README.md","avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:49:33.127Z","namespace":{"id":5478103,"name":"RaameshB","path":"RaameshB","kind":"user","full_path":"RaameshB","parent_id":null,"avatar_url":"/uploads/-/system/user/avatar/4182813/avatar.png","web_url":"https://gitlab.com/RaameshB"}},{"id":30301459,"description":"","name":"gestion des produit","name_with_namespace":"Yannick ESSOMESSA27 / gestion des produit","path":"gestion-des-produit","path_with_namespace":"ESSOMESSA27/gestion-des-produit","created_at":"2021-10-08T23:47:06.180Z","default_branch":"main","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:ESSOMESSA27/gestion-des-produit.git","http_url_to_repo":"https://gitlab.com/ESSOMESSA27/gestion-des-produit.git","web_url":"https://gitlab.com/ESSOMESSA27/gestion-des-produit","readme_url":null,"avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:47:06.180Z","namespace":{"id":11141521,"name":"Yannick ESSOMESSA27","path":"ESSOMESSA27","kind":"user","full_path":"ESSOMESSA27","parent_id":null,"avatar_url":"https://secure.gravatar.com/avatar/fc3927b183988d1a62bbb5d3bd835520?s=80\u0026d=identicon","web_url":"https://gitlab.com/ESSOMESSA27"}},{"id":30301457,"description":"Marketing place in Laravel Project 6.*","name":"mktplaceLaravel","name_with_namespace":"Bruno DeBrito / mktplaceLaravel","path":"mktplacelaravel","path_with_namespace":"brunordebrito/mktplacelaravel","created_at":"2021-10-08T23:46:59.363Z","default_branch":"main","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:brunordebrito/mktplacelaravel.git","http_url_to_repo":"https://gitlab.com/brunordebrito/mktplacelaravel.git","web_url":"https://gitlab.com/brunordebrito/mktplacelaravel","readme_url":"https://gitlab.com/brunordebrito/mktplacelaravel/-/blob/main/README.md","avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:46:59.363Z","namespace":{"id":10943827,"name":"Bruno DeBrito","path":"brunordebrito","kind":"user","full_path":"brunordebrito","parent_id":null,"avatar_url":"https://secure.gravatar.com/avatar/080f15f83f7c88d9c22e7b29cf85cefd?s=80\u0026d=identicon","web_url":"https://gitlab.com/brunordebrito"}},{"id":30301443,"description":"","name":"Ecom 2","name_with_namespace":"Fanny Bagus / Ecom 2","path":"ecom-2","path_with_namespace":"fannybagus2nd/ecom-2","created_at":"2021-10-08T23:45:13.945Z","default_branch":"master","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:fannybagus2nd/ecom-2.git","http_url_to_repo":"https://gitlab.com/fannybagus2nd/ecom-2.git","web_url":"https://gitlab.com/fannybagus2nd/ecom-2","readme_url":"https://gitlab.com/fannybagus2nd/ecom-2/-/blob/master/README.md","avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:45:13.945Z","namespace":{"id":7461662,"name":"Fanny Bagus","path":"fannybagus2nd","kind":"user","full_path":"fannybagus2nd","parent_id":null,"avatar_url":"https://secure.gravatar.com/avatar/b6bcd672ae89a7b023f909c4abc605b3?s=80\u0026d=identicon","web_url":"https://gitlab.com/fannybagus2nd"}},{"id":30301435,"description":"","name":"Didi_Complain","name_with_namespace":"Didi_Team / Didi_Complain","path":"didi_complain","path_with_namespace":"didi_team/didi_complain","created_at":"2021-10-08T23:44:00.034Z","default_branch":"main","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:didi_team/didi_complain.git","http_url_to_repo":"https://gitlab.com/didi_team/didi_complain.git","web_url":"https://gitlab.com/didi_team/didi_complain","readme_url":null,"avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:44:00.034Z","namespace":{"id":13673459,"name":"Didi_Team","path":"didi_team","kind":"group","full_path":"didi_team","parent_id":null,"avatar_url":null,"web_url":"https://gitlab.com/groups/didi_team"}},{"id":30301424,"description":"lexset screws conversion snippets","name":"Lexset Screws Conversion Snippets","name_with_namespace":"muhammadabdullah34907 / Lexset Screws Conversion Snippets","path":"lexset-screws-conversion-snippets","path_with_namespace":"muhammadabdullah34907/lexset-screws-conversion-snippets","created_at":"2021-10-08T23:42:36.192Z","default_branch":"main","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:muhammadabdullah34907/lexset-screws-conversion-snippets.git","http_url_to_repo":"https://gitlab.com/muhammadabdullah34907/lexset-screws-conversion-snippets.git","web_url":"https://gitlab.com/muhammadabdullah34907/lexset-screws-conversion-snippets","readme_url":"https://gitlab.com/muhammadabdullah34907/lexset-screws-conversion-snippets/-/blob/main/README.md","avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:42:36.192Z","namespace":{"id":8163353,"name":"muhammadabdullah34907","path":"muhammadabdullah34907","kind":"user","full_path":"muhammadabdullah34907","parent_id":null,"avatar_url":"https://secure.gravatar.com/avatar/7e039fac9c5db221ddb3c4a7656b2dc6?s=80\u0026d=identicon","web_url":"https://gitlab.com/muhammadabdullah34907"}},{"id":30301420,"description":"MySQL Classic Models","name":"s05-a1","name_with_namespace":"Zuitt Projects / Intro to MySQL for MongoDB Developers / s05-a1","path":"s05-a1","path_with_namespace":"delacruzsamuelm-zuitt-projects/b141/s05-a1","created_at":"2021-10-08T23:42:13.576Z","default_branch":"master","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:delacruzsamuelm-zuitt-projects/b141/s05-a1.git","http_url_to_repo":"https://gitlab.com/delacruzsamuelm-zuitt-projects/b141/s05-a1.git","web_url":"https://gitlab.com/delacruzsamuelm-zuitt-projects/b141/s05-a1","readme_url":null,"avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:42:13.576Z","namespace":{"id":13604214,"name":"Intro to MySQL for MongoDB Developers","path":"b141","kind":"group","full_path":"delacruzsamuelm-zuitt-projects/b141","parent_id":13511985,"avatar_url":null,"web_url":"https://gitlab.com/groups/delacruzsamuelm-zuitt-projects/b141"}},{"id":30301416,"description":"","name":"Stock Gestion","name_with_namespace":"Yannick ESSOMESSA27 / Stock Gestion","path":"stock-gestion","path_with_namespace":"ESSOMESSA27/stock-gestion","created_at":"2021-10-08T23:40:58.143Z","default_branch":"main","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:ESSOMESSA27/stock-gestion.git","http_url_to_repo":"https://gitlab.com/ESSOMESSA27/stock-gestion.git","web_url":"https://gitlab.com/ESSOMESSA27/stock-gestion","readme_url":null,"avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:40:58.143Z","namespace":{"id":11141521,"name":"Yannick ESSOMESSA27","path":"ESSOMESSA27","kind":"user","full_path":"ESSOMESSA27","parent_id":null,"avatar_url":"https://secure.gravatar.com/avatar/fc3927b183988d1a62bbb5d3bd835520?s=80\u0026d=identicon","web_url":"https://gitlab.com/ESSOMESSA27"}},{"id":30301415,"description":"VR - Game Dev UE4","name":"SparkDev_VR","name_with_namespace":"Dariel Brito / SparkDev_VR","path":"SparkDev_VR","path_with_namespace":"Dariel305/SparkDev_VR","created_at":"2021-10-08T23:40:52.006Z","default_branch":"main","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:Dariel305/SparkDev_VR.git","http_url_to_repo":"https://gitlab.com/Dariel305/SparkDev_VR.git","web_url":"https://gitlab.com/Dariel305/SparkDev_VR","readme_url":null,"avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:40:52.006Z","namespace":{"id":13661060,"name":"Dariel Brito","path":"Dariel305","kind":"user","full_path":"Dariel305","parent_id":null,"avatar_url":"https://secure.gravatar.com/avatar/0e264f01f3f87c240eca956bd060fb73?s=80\u0026d=identicon","web_url":"https://gitlab.com/Dariel305"}},{"id":30301413,"description":"Easy install scripts for the  [dhc](https://github.com/jmgao/dhc) input wrapper","name":"DHC Installers","name_with_namespace":"Luberrys Custom Controllers LLC / DHC Installers","path":"dhc-installers","path_with_namespace":"luberryscc/dhc-installers","created_at":"2021-10-08T23:40:27.337Z","default_branch":"master","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:luberryscc/dhc-installers.git","http_url_to_repo":"https://gitlab.com/luberryscc/dhc-installers.git","web_url":"https://gitlab.com/luberryscc/dhc-installers","readme_url":"https://gitlab.com/luberryscc/dhc-installers/-/blob/master/README.md","avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:40:27.337Z","namespace":{"id":12157791,"name":"Luberrys Custom Controllers LLC","path":"luberryscc","kind":"group","full_path":"luberryscc","parent_id":null,"avatar_url":"/uploads/-/system/group/avatar/12157791/lcclogocircle300dpi.png","web_url":"https://gitlab.com/groups/luberryscc"}},{"id":30301410,"description":null,"name":"Didi_Complain","name_with_namespace":"vahid kamrani / Didi_Complain","path":"Didi_Complain","path_with_namespace":"vahidkamrani/Didi_Complain","created_at":"2021-10-08T23:39:49.858Z","default_branch":"main","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:vahidkamrani/Didi_Complain.git","http_url_to_repo":"https://gitlab.com/vahidkamrani/Didi_Complain.git","web_url":"https://gitlab.com/vahidkamrani/Didi_Complain","readme_url":null,"avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:39:49.858Z","namespace":{"id":13670818,"name":"vahid kamrani","path":"vahidkamrani","kind":"user","full_path":"vahidkamrani","parent_id":null,"avatar_url":"/uploads/-/system/user/avatar/9925255/avatar.png","web_url":"https://gitlab.com/vahidkamrani"}},{"id":30301408,"description":"Main repository for STAT 545 @ University of British Columbia, a course in data wrangling, exploration, and analysis with R.","name":"STAT545-UBC-github-io","name_with_namespace":"Rene Essomba / STAT545-UBC-github-io","path":"STAT545-UBC-github-io","path_with_namespace":"franckess/STAT545-UBC-github-io","created_at":"2021-10-08T23:39:27.826Z","default_branch":"master","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:franckess/STAT545-UBC-github-io.git","http_url_to_repo":"https://gitlab.com/franckess/STAT545-UBC-github-io.git","web_url":"https://gitlab.com/franckess/STAT545-UBC-github-io","readme_url":"https://gitlab.com/franckess/STAT545-UBC-github-io/-/blob/master/README.md","avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:39:27.826Z","namespace":{"id":13673428,"name":"Rene Essomba","path":"franckess","kind":"user","full_path":"franckess","parent_id":null,"avatar_url":"/uploads/-/system/user/avatar/9926964/avatar.png","web_url":"https://gitlab.com/franckess"}},{"id":30301407,"description":"A curated list of #rstats books","name":"rbooks","name_with_namespace":"Rene Essomba / rbooks","path":"rbooks","path_with_namespace":"franckess/rbooks","created_at":"2021-10-08T23:39:21.130Z","default_branch":"master","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:franckess/rbooks.git","http_url_to_repo":"https://gitlab.com/franckess/rbooks.git","web_url":"https://gitlab.com/franckess/rbooks","readme_url":"https://gitlab.com/franckess/rbooks/-/blob/master/README.md","avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:39:21.130Z","namespace":{"id":13673428,"name":"Rene Essomba","path":"franckess","kind":"user","full_path":"franckess","parent_id":null,"avatar_url":"/uploads/-/system/user/avatar/9926964/avatar.png","web_url":"https://gitlab.com/franckess"}},{"id":30301406,"description":"Using R with many CPUs ","name":"R-parallel","name_with_namespace":"Rene Essomba / R-parallel","path":"R-parallel","path_with_namespace":"franckess/R-parallel","created_at":"2021-10-08T23:39:17.772Z","default_branch":"gh-pages","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:franckess/R-parallel.git","http_url_to_repo":"https://gitlab.com/franckess/R-parallel.git","web_url":"https://gitlab.com/franckess/R-parallel","readme_url":"https://gitlab.com/franckess/R-parallel/-/blob/gh-pages/README.md","avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:39:17.772Z","namespace":{"id":13673428,"name":"Rene Essomba","path":"franckess","kind":"user","full_path":"franckess","parent_id":null,"avatar_url":"/uploads/-/system/user/avatar/9926964/avatar.png","web_url":"https://gitlab.com/franckess"}},{"id":30301405,"description":"Predictive Maintenance using Pyspark","name":"PySpark-Predictive-Maintenance","name_with_namespace":"Rene Essomba / PySpark-Predictive-Maintenance","path":"PySpark-Predictive-Maintenance","path_with_namespace":"franckess/PySpark-Predictive-Maintenance","created_at":"2021-10-08T23:39:12.573Z","default_branch":"master","tag_list":[],"topics":[],"ssh_url_to_repo":"git@gitlab.com:franckess/PySpark-Predictive-Maintenance.git","http_url_to_repo":"https://gitlab.com/franckess/PySpark-Predictive-Maintenance.git","web_url":"https://gitlab.com/franckess/PySpark-Predictive-Maintenance","readme_url":"https://gitlab.com/franckess/PySpark-Predictive-Maintenance/-/blob/master/README.md","avatar_url":null,"forks_count":0,"star_count":0,"last_activity_at":"2021-10-08T23:39:12.573Z","namespace":{"id":13673428,"name":"Rene Essomba","path":"franckess","kind":"user","full_path":"franckess","parent_id":null,"avatar_url":"/uploads/-/system/user/avatar/9926964/avatar.png","web_url":"https://gitlab.com/franckess"}}]
```


以上簡単な備忘です。