GitLab API icon

GitLab API

Gitlab

Actions1062

Snippets → getApiV4SnippetsIdFilesRefFilePathRaw

AI-generated

Summary

Retrieve raw file content from a GitLab snippet

Inputs

  • id (required) — The snippet ID (integer, int32 format)
  • ref (required) — The name of branch, tag or commit
  • file_path (required) — The url encoded path to the file, e.g. lib%2Fclass%2Erb

Output shape

Raw file content as string

Returns the raw content of the specified file within the snippet

Examples

Example 1: Fetch raw content of a file from a snippet on the main branch

Set id to the snippet numeric ID, ref to 'main', and file_path to the URL-encoded path (e.g. 'lib/utils.rb')

Links

Discussion