diff options
Diffstat (limited to 'doc/api/project_snippets.md')
-rw-r--r-- | doc/api/project_snippets.md | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/doc/api/project_snippets.md b/doc/api/project_snippets.md index 95477cdc765..242edf7d768 100644 --- a/doc/api/project_snippets.md +++ b/doc/api/project_snippets.md @@ -8,16 +8,16 @@ info: To determine the technical writer assigned to the Stage/Group associated w ## Snippet visibility level -Snippets in GitLab can be either private, internal or public. +[Snippets](../api/project_snippets.md) in GitLab can be either private, internal or public. 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, @@ -37,7 +37,7 @@ Parameters: | Attribute | Type | Required | Description | |-----------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| -| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `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 @@ -51,8 +51,8 @@ Parameters: | Attribute | Type | Required | Description | |--------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| -| `id` | integer or string | yes | The ID or [URL-encoded path of the project](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. | ```json { @@ -88,15 +88,15 @@ Parameters: | Attribute | Type | Required | Description | |:------------------|:----------------|:---------|:----------------------------------------------------------------------------------------------------------------| -| `id` | integer or string | yes | The ID or [URL-encoded path of the project](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 | +| `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 | +| `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. | Example request: @@ -127,6 +127,8 @@ 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. + ```plaintext PUT /projects/:id/snippets/:snippet_id ``` @@ -135,20 +137,18 @@ Parameters: | Attribute | Type | Required | Description | |:----------------------|:----------------|:---------|:----------------------------------------------------------------------------------------------------------------| -| `id` | integer or string | yes | The ID or [URL-encoded path of the project](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 | +| `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` | 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 | - -Updates to snippets with multiple files *must* use the `files` attribute. +| `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. | Example request: @@ -188,8 +188,8 @@ Parameters: | Attribute | Type | Required | Description | |:-------------|:---------------|:---------|:----------------------------------------------------------------------------------------------------------------| -| `id` | integer or string | yes | The ID or [URL-encoded path of the project](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: @@ -210,8 +210,8 @@ Parameters: | Attribute | Type | Required | Description | |:-------------|:---------------|:---------|:----------------------------------------------------------------------------------------------------------------| -| `id` | integer or string | yes | The ID or [URL-encoded path of the project](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: @@ -232,10 +232,10 @@ Parameters: | Attribute | Type | Required | Description | |:-------------|:---------------|:---------|:----------------------------------------------------------------------------------------------------------------| -| `id` | integer or string | yes | The ID or [URL-encoded path of the project](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 | +| `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. | Example request: @@ -254,8 +254,8 @@ 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](index.md#namespaced-path-encoding) owned by the authenticated user | -| `snippet_id` | Integer | yes | The ID of a 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 snippet. | Example request: |