GitLab API

GitlabTool

Actions1095

Project_snippets → getApiV4ProjectsIdSnippetsSnippetId

AI-generated

Summary

Retrieves a project snippet from the GitLab API using the configured HTTP method, which defaults to GET. Provide the project ID or URL-encoded path and the snippet ID in Path Parameters; authentication is enabled by default, and the base URL defaults to https://gitlab.com but is defined by the GitLab API credential.

Inputs

  • Skip Authentication — Defaults to false. Set true to skip authentication; otherwise the GitLab API credential is used.
  • baseUrl — Defaults to https://gitlab.com. The source says the base URL is defined in the gitlabApi credential.
  • Method — HTTP method for the request: GET, POST, PUT, DELETE, HEAD, or PATCH. Defaults to GET.
  • Path Parameters: Id (required) — Project ID or URL-encoded project path.
  • Path Parameters: Snippet_id (required) — ID of the project snippet.

Output shape

A single GitLab API response item containing the project snippet data.

The operation calls /api/v4/projects/{id}/snippets/{snippet_id}. The precise response fields and error shape are not specified by the provided properties or source.

Examples

Example 1: Create a project snippet

resource: Project_snippets, operation: postApiV4ProjectsIdSnippets, Path Parameters: {"id":"123"}, name: "snippet", content: "snippet content", file_name: "example.txt", visibility: "private", method: post. The project is specified by its ID, and the snippet name, content, filename, and visibility are supplied as request body parameters to create a private snippet; defaults to the credential's GitLab base URL and authentication.

Example 2: Find a project snippet by ID

resource: Project_snippets, operation: getApiV4ProjectsIdSnippetsSnippetId, Path Parameters: {"id":"123","snippet_id":"456"}, method: get. The project is specified by its ID and the snippet by its ID; defaults to the credential's GitLab base URL and authentication.

Example 3: Update a project snippet

resource: Project_snippets, operation: putApiV4ProjectsIdSnippetsSnippetId, Path Parameters: {"id":"123","snippet_id":"456"}, name: "updated snippet", content: "updated snippet content", method: put. The project and snippet are specified by their IDs, and the snippet is updated with the supplied name and content; defaults to the credential's GitLab base URL and authentication.

Links

Discussion