Canteens API

The Canteens API allows to query for all canteens or a geographical filtered subset. Canteens are supposed to not change very often and should be cached locally.

List canteens

List all canteens:

GET /canteens

Parameters

near[lat], near[lng]
Optional float - Searches for canteens near given coordinates. Both coordinates must be given.
near[dist]
Optional float - Maximum distance to search for canteens near given coordinates. Requires given latitude and longitude. Default distance is 10 km.
ids
Optional string - A comma separated list of canteen IDs that should be returned.
hasCoordinates
Optional true or false - Should only canteens with (true) or without (false) coordinates be returned.

Response

$ curl -i http://openmensa.org/api/v2/canteens
Status: 200 OK
Link: <http://openmensa.org/api/v2/canteens?page=2>; rel="next",
      <http://openmensa.org/api/v2/canteens?page=5>; rel="last"
X-Total-Pages: 5
[
  {
    "id": 1,
    "name": "Mensa UniCampus Magdeburg",
    "address": "Pfälzer Str. 1, 39106 Magdeburg",
    "coordinates": null
  },
  {
    "id": 104,
    "name": "Bistro Tasty Studio Babelsberg",
    "address": "August-Bebel-Str. 26-53, 14482 Potsdam, Deutschland",
    "coordinates": [
      52.3877669669544,
      13.1209909915924
    ]
  }
]

Examples

Return all canteens within a 5 km radius around the Uni Potsdam canteen in Griebnitzsee.

$ curl -i http://openmensa.org/api/v2/canteens?near[lat]=52.393535&near[lng]=13.127814&near[dist]=5

Get a single canteen

GET /canteens/:id

Reponse

$ curl -i http://openmensa.org/api/v2/canteens/1
Status: 200 OK
{
  "id": 1,
  "name": "Mensa UniCampus Magdeburg",
  "address": "Pfälzer Str. 1, 39106 Magdeburg",
  "coordinates": null
}
id
int - The canteen’s numeric ID, which identifies it uniquely within the API.
name
string - The canteen’s name.
address
string - A human readable real-world locator (vulgo street address).
coordinates
list of floats (or null) - The coordinates of the canteen, given as list of latitude and longitude in north-eastern direction (negative values imply southern or western hemisphere). Can be null if coordinates are unknown.