GitLab API icon

GitLab API

Gitlab

Actions1062

Projects → getApiV4ProjectsIdRepositoryFilesFilePath

AI-generated

Summary

Retrieve the content and metadata of a specific file in a GitLab project repository by its file path and reference (branch, tag, or commit).

Inputs

  • id (required) — The project ID or URL-encoded path (e.g., 'gitlab-org/gitlab') to identify the project.
  • file_path (required) — The URL-encoded file path within the repository to specify which file to fetch.
  • ref (required) — The branch name, tag, or commit SHA to specify the version of the file to retrieve.
  • Skip Authentication — Optionally skip using authentication credentials for the API call.
  • Authentication — Specifies the authentication method to use, typically 'GitlabApi' credential.
  • baseUrl — Base URL of the GitLab instance; defaults to 'https://gitlab.com'.
  • Method — HTTP method for the request; defaults to GET.

Output shape

a single record containing the file's content and metadata as returned by the GitLab API

The response includes file details encoded according to the GitLab API for repository files. The request requires valid authentication unless 'Skip Authentication' is enabled.

Examples

Example 1: Retrieve a README file from the main branch of a project

Set 'id' to the project identifier, 'file_path' to 'README.md' URL-encoded, and 'ref' to 'main'. Use the GET method to fetch file content.

Links

Discussion