summaryrefslogtreecommitdiff
path: root/doc/api/snippets.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/api/snippets.md')
-rw-r--r--doc/api/snippets.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/api/snippets.md b/doc/api/snippets.md
index 1aa3eecfd29..db94716c2d4 100644
--- a/doc/api/snippets.md
+++ b/doc/api/snippets.md
@@ -150,6 +150,34 @@ Example response:
Hello World snippet
```
+## Snippet repository file content
+
+Returns the raw file content as plain text.
+
+```plaintext
+GET /snippets/:id/files/:ref/:file_path/raw
+```
+
+Parameters:
+
+| Attribute | Type | Required | Description |
+|:------------|:--------|:---------|:-------------------------------------------------------------------|
+| `id` | integer | yes | ID of snippet to retrieve |
+| `ref` | string | yes | Reference to a tag, branch or commit |
+| `file_path` | string | yes | URL-encoded path to the file |
+
+Example request:
+
+```shell
+curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/snippets/1/files/master/snippet%2Erb/raw"
+```
+
+Example response:
+
+```plaintext
+Hello World snippet
+```
+
## Create new snippet
Create a new snippet.