Skip to content

Latest commit

 

History

History
43 lines (36 loc) · 741 Bytes

File metadata and controls

43 lines (36 loc) · 741 Bytes

GET endpoints

GET /api/snippets

Return all non-private snippets together with some information about the user. Example response:

[
  {
    "id": 1,
    "created_at": "...",
    "title": "avg.js",
    "contents": "console.log('1')",
    "is_private": false,
    "user": {
      "id": 1,
      "first_name": "Orhan",
      "last_name": "Toy"
    }
  }
]

GET /api/snippets/:id

Return a single snippet. Example response:

{
  "id": 1,
  "created_at": "...",
  "title": "avg.js",
  "contents": "console.log('1')",
  "is_private": true,
  "user": {
    "id": 1,
    "first_name": "Orhan",
    "last_name": "Toy"
  }
}

Not found: we respond with a 404 if the snippet with the given ID cannot be found.