GitLab API

GitlabTool

Actions1095

Merge_requests → getApiV4ProjectsIdMergeRequestsMergeRequestIidDiffs

AI-generated

Summary

Retrieve the diff data of a specific merge request in a GitLab project, optionally paginated and formatted as unified diff.

Inputs

  • id (required) — The ID or URL-encoded path of the GitLab project containing the merge request.
  • merge_request_iid (required) — The internal ID (IID) of the merge request within the project.
  • page — The page number to return for paginated results (default is 1).
  • per_page — The number of diff items per page for pagination (default is 20).
  • unidiff — Boolean flag to request the diff in Unified diff format (default is false).

Output shape

a list of diff objects representing the changes in the specified merge request, corresponding to the GitLab API response format

Supports pagination via 'page' and 'per_page' query parameters. The 'unidiff' flag controls the diff format. Authentication is required unless skipped. The returned data aligns with the '/api/v4/projects/{id}/merge_requests/{merge_request_iid}/diffs' endpoint response structure.

Examples

Example 1: Get first page of merge request diffs

id='my-project', merge_request_iid=10, page=1, per_page=20, unidiff=false

Example 2: Get unified diff format of merge request changes

id='my-project', merge_request_iid=10, unidiff=true

Links

Discussion