snippets

List all public snippets

Lists all public snippets accessible to the currently authenticated user.

get/api/v4/snippets/public

Request

  • Base URL
    https://gitlab.com
  • Auth
    none declared

Query parameters

created_afterstring date-time

Return snippets created after the specified time

created_beforestring date-time

Return snippets created before the specified time

pageinteger

Current page number

per_pageinteger

Number of items per page

Response

List all public snippets

idinteger required
titlestring required
descriptionstring required
visibilitystring required
created_atstring date-time required
updated_atstring date-time required
project_idinteger required
web_urlstring required
raw_urlstring required
ssh_url_to_repostring
http_url_to_repostring
file_namestring required
filesobject[] required
importedboolean required
imported_fromstring required
repository_storagestring

Example response

[
  {
    "id": 1,
    "title": "test",
    "description": "Ruby test snippet",
    "visibility": "public",
    "author": {
      "id": 1,
      "username": "admin",
      "public_email": "john@example.com",
      "name": "Administrator",
      "state": "active",
      "avatar_url": "https://gravatar.com/avatar/1",
      "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
      "custom_attributes": [
        {
          "key": "foo",
          "value": "bar"
        }
      ],
      "web_url": "https://gitlab.example.com/root"
    },
    "created_at": "2012-06-28T10:52:04Z",
    "updated_at": "2012-06-28T10:52:04Z",
    "project_id": 1,
    "web_url": "http://example.com/example/example/snippets/1",
    "raw_url": "http://example.com/example/example/snippets/1/raw",
    "ssh_url_to_repo": "ssh://user@gitlab.example.com/snippets/65.git",
    "http_url_to_repo": "https://gitlab.example.com/snippets/65.git",
    "file_name": "add.rb",
    "files": [
      {
        "path": "file.txt",
        "raw_url": "https://gitlab.example.com/.../raw"
      }
    ],
    "imported_from": "none",
    "repository_storage": "default"
  }
]

Changes

No recorded changes to this operation across all 5 revisions of this API.