summaryrefslogtreecommitdiff
path: root/doc/api/project_snippets.md
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 16:05:49 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 16:05:49 +0000
commit43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch)
treedceebdc68925362117480a5d672bcff122fb625b /doc/api/project_snippets.md
parent20c84b99005abd1c82101dfeff264ac50d2df211 (diff)
downloadgitlab-ce-0f94cf6ca9d272d8e0fda4a7a597866cf3dc1fc0.tar.gz
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc4216-0-stable
Diffstat (limited to 'doc/api/project_snippets.md')
-rw-r--r--doc/api/project_snippets.md108
1 files changed, 53 insertions, 55 deletions
diff --git a/doc/api/project_snippets.md b/doc/api/project_snippets.md
index 242edf7d768..e39836f2781 100644
--- a/doc/api/project_snippets.md
+++ b/doc/api/project_snippets.md
@@ -13,11 +13,9 @@ You can set it with the `visibility` field in the snippet.
Constants for snippet visibility levels are:
-| visibility | Description |
-| ---------- | ----------- |
-| `private` | The snippet is visible only to project members. |
-| `internal` | The snippet is visible for any authenticated user except [external users](../user/admin_area/external_users.md). |
-| `public` | The snippet can be accessed without any authentication. |
+- **Private**: The snippet is visible only to project members.
+- **Internal**: The snippet is visible for any authenticated user except [external users](../user/admin_area/external_users.md).
+- **Public**: The snippet can be accessed without any authentication.
NOTE:
From July 2019, the `Internal` visibility setting is disabled for new projects, groups,
@@ -35,9 +33,9 @@ GET /projects/:id/snippets
Parameters:
-| Attribute | Type | Required | Description |
-|-----------|----------------|----------|-----------------------------------------------------------------------------------------------------------------|
-| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
+| Attribute | Type | Required | Description |
+|-----------|----------------|----------|-------------|
+| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user.
## Single snippet
@@ -49,10 +47,10 @@ GET /projects/:id/snippets/:snippet_id
Parameters:
-| Attribute | Type | Required | Description |
-|--------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------|
-| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
-| `snippet_id` | integer | yes | The ID of a project's snippet. |
+| Attribute | Type | Required | Description |
+|--------------|----------------|----------|-------------|
+| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user.
+| `snippet_id` | integer | yes | The ID of a project's snippet.
```json
{
@@ -86,17 +84,17 @@ POST /projects/:id/snippets
Parameters:
-| Attribute | Type | Required | Description |
-|:------------------|:----------------|:---------|:----------------------------------------------------------------------------------------------------------------|
-| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
-| `title` | string | yes | Title of a snippet. |
-| `file_name` | string | no | Deprecated: Use `files` instead. Name of a snippet file. |
-| `content` | string | no | Deprecated: Use `files` instead. Content of a snippet. |
-| `description` | string | no | Description of a snippet. |
-| `visibility` | string | no | Snippet's [visibility](#snippet-visibility-level) |
-| `files` | array of hashes | no | An array of snippet files. |
-| `files:file_path` | string | yes | File path of the snippet file. |
-| `files:content` | string | yes | Content of the snippet file. |
+| Attribute | Type | Required | Description |
+|:------------------|:----------------|:---------|:------------|
+| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user.
+| `files:content` | string | yes | Content of the snippet file.
+| `files:file_path` | string | yes | File path of the snippet file.
+| `title` | string | yes | Title of a snippet.
+| `content` | string | no | Deprecated: Use `files` instead. Content of a snippet.
+| `description` | string | no | Description of a snippet.
+| `file_name` | string | no | Deprecated: Use `files` instead. Name of a snippet file.
+| `files` | array of hashes | no | An array of snippet files.
+| `visibility` | string | no | Snippet's [visibility](#snippet-visibility-level).
Example request:
@@ -127,7 +125,7 @@ curl --request POST "https://gitlab.com/api/v4/projects/:id/snippets" \
Updates an existing project snippet. The user must have permission to change an existing snippet.
-Updates to snippets with multiple files *must* use the `files` attribute.
+Updates to snippets with multiple files must use the `files` attribute.
```plaintext
PUT /projects/:id/snippets/:snippet_id
@@ -135,20 +133,20 @@ PUT /projects/:id/snippets/:snippet_id
Parameters:
-| Attribute | Type | Required | Description |
-|:----------------------|:----------------|:---------|:----------------------------------------------------------------------------------------------------------------|
-| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
-| `snippet_id` | integer | yes | The ID of a project's snippet. |
-| `title` | string | no | Title of a snippet. |
-| `file_name` | string | no | Deprecated: Use `files` instead. Name of a snippet file. |
-| `content` | string | no | Deprecated: Use `files` instead. Content of a snippet. |
-| `description` | string | no | Description of a snippet. |
-| `visibility` | string | no | Snippet's [visibility](#snippet-visibility-level) |
-| `files` | array of hashes | no | An array of snippet files. |
-| `files:action` | string | yes | Type of action to perform on the file, one of: `create`, `update`, `delete`, `move` |
-| `files:file_path` | string | no | File path of the snippet file. |
-| `files:previous_path` | string | no | Previous path of the snippet file. |
-| `files:content` | string | no | Content of the snippet file. |
+| Attribute | Type | Required | Description |
+|:----------------------|:----------------|:---------|:------------|
+| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user.
+| `files:action` | string | yes | Type of action to perform on the file. One of: `create`, `update`, `delete`, `move`.
+| `snippet_id` | integer | yes | The ID of a project's snippet.
+| `content` | string | no | Deprecated: Use `files` instead. Content of a snippet.
+| `description` | string | no | Description of a snippet.
+| `files` | array of hashes | no | An array of snippet files.
+| `files:content` | string | no | Content of the snippet file.
+| `files:file_path` | string | no | File path of the snippet file.
+| `file_name` | string | no | Deprecated: Use `files` instead. Name of a snippet file.
+| `files:previous_path` | string | no | Previous path of the snippet file.
+| `title` | string | no | Title of a snippet.
+| `visibility` | string | no | Snippet's [visibility](#snippet-visibility-level).
Example request:
@@ -186,10 +184,10 @@ DELETE /projects/:id/snippets/:snippet_id
Parameters:
-| Attribute | Type | Required | Description |
-|:-------------|:---------------|:---------|:----------------------------------------------------------------------------------------------------------------|
-| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
-| `snippet_id` | integer | yes | The ID of a project's snippet. |
+| Attribute | Type | Required | Description |
+|:-------------|:---------------|:---------|:------------|
+| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user.
+| `snippet_id` | integer | yes | The ID of a project's snippet.
Example request:
@@ -208,10 +206,10 @@ GET /projects/:id/snippets/:snippet_id/raw
Parameters:
-| Attribute | Type | Required | Description |
+| Attribute | Type | Required | Description |
|:-------------|:---------------|:---------|:----------------------------------------------------------------------------------------------------------------|
-| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
-| `snippet_id` | integer | yes | The ID of a project's snippet. |
+| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user.
+| `snippet_id` | integer | yes | The ID of a project's snippet.
Example request:
@@ -230,12 +228,12 @@ GET /projects/:id/snippets/:snippet_id/files/:ref/:file_path/raw
Parameters:
-| Attribute | Type | Required | Description |
-|:-------------|:---------------|:---------|:----------------------------------------------------------------------------------------------------------------|
-| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user |
-| `snippet_id` | integer | yes | The ID of a project's snippet. |
-| `ref` | string | yes | The name of a branch, tag or commit, for example, main. |
-| `file_path` | string | yes | The URL-encoded path to the file, for example, snippet%2Erb. |
+| Attribute | Type | Required | Description |
+|:-------------|:---------------|:---------|:------------|
+| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user.
+| `file_path` | string | yes | The URL-encoded path to the file, for example, `snippet%2Erb`.
+| `ref` | string | yes | The name of a branch, tag or commit, for example, `main`.
+| `snippet_id` | integer | yes | The ID of a project's snippet.
Example request:
@@ -252,10 +250,10 @@ Available only for users with administrator access.
GET /projects/:id/snippets/:snippet_id/user_agent_detail
```
-| Attribute | Type | Required | Description |
-|--------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------|
-| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user. |
-| `snippet_id` | Integer | yes | The ID of a snippet. |
+| Attribute | Type | Required | Description |
+|--------------|----------------|----------|-------------|
+| `id` | integer or string | yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding) owned by the authenticated user.
+| `snippet_id` | Integer | yes | The ID of a snippet.
Example request: