GitLab API icon

GitLab API

Gitlab

Actions880

Overview

This node operation retrieves a specific project snippet from a GitLab project using the GitLab API. It is useful for scenarios where you need to access the content or metadata of a particular snippet within a project, such as for code review, sharing, or automation purposes. For example, a developer might use this node to fetch a snippet by its ID to display or process it in an external system.

Use Case Examples

  1. Fetching a project snippet by providing the project ID and snippet ID to integrate snippet content into a documentation system.
  2. Automating the retrieval of code snippets from GitLab projects for analysis or backup.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the request (boolean). Defaults to false.
Authentication The authentication method used for the request, hidden unless Skip Authentication is false. Defaults to GitLab API key authentication.
baseUrl The base URL of the GitLab instance. Defaults to https://gitlab.com.
Method The HTTP method used for the request. Defaults to GET.
Path Parameters Parameters for the request path, including the project ID or URL-encoded path and the snippet ID.

Output

JSON

  • id - The unique identifier of the snippet.
  • title - The title of the snippet.
  • file_name - The file name of the snippet.
  • author - Information about the author of the snippet.
  • content - The content of the snippet.
  • created_at - The creation timestamp of the snippet.
  • updated_at - The last update timestamp of the snippet.
  • project_id - The ID of the project to which the snippet belongs.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID and snippet ID are correctly provided and URL-encoded if necessary.
  • Verify that the GitLab API key credential is valid and has sufficient permissions to access project snippets.
  • If authentication is skipped, ensure the GitLab instance allows unauthenticated access to snippets, otherwise the request will fail.
  • Common error messages include 404 Not Found if the snippet or project does not exist, and 401 Unauthorized if authentication fails.

Links

Discussion