Favs API

Not yet implemented!

Authentication

You need to be authorized by OAuth to read and write a user’s favorites.

List favs

List the current users favs:

GET /favs

The server will output them sorted ascendingly by sort_value.

Response

Status: 200 OK
[
  {
    "id": 55,
    "canteen_id": 1,
    "sort_value": 4
  },
  {
    "id": 56,
    "canteen_id": 2,
    "sort_value": 6
  }
]

Get a single fav

GET /favs/:id

Response

Status: 200 OK
{
  "id": 55,
  "canteen_id": 1,
  "sort_value": 4
}

Create

POST /favs

Input

canteen_id
Required integer - The referenced canteen, needs to be unique among a user’s favorites list.
sort_value
Required non-negative integer - A value by which the favorites are sorted ascendingly; the sequence of sort_values may contain duplicates or gaps.
{
  "canteen_id": 1,
  "index": 6
}

Response

Status: 201 Created
{
  "id": 55,
  "canteen_id": 1,
  "sort_value": 4
}

Errors

On duplicate canteen_id:

Status: 409 Conflict

Edit

PATCH /favs/:id

Input

canteen_id
Optional integer - The referenced canteen, needs to be unique among a user’s favorites list.
index
Optional non-negative integer - A value by which the favorites are sorted ascendingly; the sequence of sort_values may contain duplicates or gaps.
{
  "index": 6
}

Response

Status: 200 OK
{
  "id": 55,
  "canteen_id": 1,
  "sort_value": 4
}

Errors

On duplicate canteen_id:

Status: 409 Conflict

Delete

DELETE /favs/:id

Response

Status: 204 No Content