-`visibility` (required) - The snippet's visibility
Example request:
```bash
curl --request POST https://gitlab.com/api/v4/projects/:id/snippets \
--header"PRIVATE-TOKEN: <your access token>"\
--header"Content-Type: application/json"\
-d @snippet.json
```
`snippet.json` used in the above example request:
```json
{
"title":"Example Snippet Title",
"description":"More verbose snippet description",
"file_name":"example.txt",
"code":"source code \n with multiple lines\n",
"visibility":"private"
}
```
## Update snippet
Updates an existing project snippet. The user must have permission to change an existing snippet.
...
...
@@ -99,6 +120,27 @@ Parameters:
-`code` (optional) - The content of a snippet
-`visibility` (optional) - The snippet's visibility
Example request:
```bash
curl --request PUT https://gitlab.com/api/v4/projects/:id/snippets \
--header"PRIVATE-TOKEN: <your_access_token>"\
--header"Content-Type: application/json"\
-d @snippet.json
```
`snippet.json` used in the above example request:
```json
{
"title":"Updated Snippet Title",
"description":"More verbose snippet description",
"file_name":"new_filename.txt",
"code":"updated source code \n with multiple lines\n",
"visibility":"private"
}
```
## Delete snippet
Deletes an existing project snippet. This returns a `204 No Content` status code if the operation was successfully or `404` if the resource was not found.
...
...
@@ -112,6 +154,13 @@ Parameters:
-`id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user
-`snippet_id` (required) - The ID of a project's snippet