Commit 440dd360 authored by Stan Hu's avatar Stan Hu

Update project snippet API docs to use content parameter

There was some confusion over whether `code` or `content` is the right
parameter for snippets. Internally, the database stores
`content`. However:

1. Project snippets use `code`. `code` gets remapped in `content` in
`lib/api/project_snippets.rb`.

2. Personal snippets use `content`.

In GitLab 12.3,
https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/32296
standardized the APIs to use `content` while allowing the deprecated
`code` field to be used for project snippets.
parent b764b9d3
......@@ -78,7 +78,7 @@ Parameters:
- `title` (required) - The title of a snippet
- `file_name` (required) - The name of a snippet file
- `description` (optional) - The description of a snippet
- `code` (required) - The content of a snippet
- `content` (required) - The content of a snippet
- `visibility` (required) - The snippet's visibility
Example request:
......@@ -97,7 +97,7 @@ curl --request POST https://gitlab.com/api/v4/projects/:id/snippets \
"title" : "Example Snippet Title",
"description" : "More verbose snippet description",
"file_name" : "example.txt",
"code" : "source code \n with multiple lines\n",
"content" : "source code \n with multiple lines\n",
"visibility" : "private"
}
```
......@@ -117,7 +117,7 @@ Parameters:
- `title` (optional) - The title of a snippet
- `file_name` (optional) - The name of a snippet file
- `description` (optional) - The description of a snippet
- `code` (optional) - The content of a snippet
- `content` (optional) - The content of a snippet
- `visibility` (optional) - The snippet's visibility
Example request:
......@@ -136,7 +136,7 @@ curl --request PUT https://gitlab.com/api/v4/projects/:id/snippets \
"title" : "Updated Snippet Title",
"description" : "More verbose snippet description",
"file_name" : "new_filename.txt",
"code" : "updated source code \n with multiple lines\n",
"content" : "updated source code \n with multiple lines\n",
"visibility" : "private"
}
```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment