GitLab API icon

GitLab API

Gitlab

Actions917

Overview

This node operation retrieves the content of a specific file from a GitLab project's repository using the GitLab API v4. It is useful for scenarios where you need to access or display the contents of files stored in a GitLab repository programmatically, such as fetching configuration files, scripts, or documentation directly from the repository.

Use Case Examples

  1. Fetching the README file from a project's main branch to display its content in a dashboard.
  2. Retrieving a configuration file from a specific branch to use in an automated deployment process.

Properties

Name Meaning
Skip Authentication Determines whether to skip authentication for the API request.
Authentication Specifies the authentication method to use, defaulting to GitLab API authentication.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method The HTTP method to use for the request, defaulting to GET.
Parameter Schema Defines the required path and query parameters for the API call, including project ID, file path, and reference (branch, tag, or commit).
Request Path The API endpoint path template for accessing the file in the repository.
Query Parameters Additional query parameters for the request, specifically the 'ref' parameter indicating the branch, tag, or commit name.
Path Parameters Path parameters including 'id' for the project ID and 'file_path' for the URL-encoded file path in the repository.

Output

JSON

  • file_name - The name of the file retrieved from the repository.
  • file_path - The path of the file within the repository.
  • size - The size of the file in bytes.
  • encoding - The encoding format of the file content.
  • content - The base64 encoded content of the file.
  • ref - The branch, tag, or commit reference used to retrieve the file.
  • blob_id - The blob ID of the file in the repository.
  • commit_id - The commit ID associated with the file retrieval.
  • last_commit_id - The last commit ID that modified the file.

Dependencies

  • GitLab API authentication credential

Troubleshooting

  • Ensure the project ID and file path are correctly URL encoded to avoid 404 errors.
  • Verify that the 'ref' parameter (branch, tag, or commit) exists in the repository to prevent errors.
  • Check authentication credentials if receiving authorization errors.
  • Confirm the base URL is correct for self-hosted GitLab instances.

Links

Discussion