API documentation

Get parkings

GET /api/parkings

Include access_token in HTTP header:

Authorization: Bearer 09ba487fc3df...

Description

This web service returns all the parking areas (clusters of parking spots) in an area defined by the (topLeft - viewport) and (bottomRight +viewport) corners. Each of the corners is defined by latitude and longitude.

Request Parameters

Parameter name Parameter type Description
center_lat float latitude of the center of the zoomport
center_lon float longitude of the center of the zoomport
top float top-left corner latitude of the zoomport
bottom float bottom-right corner latitude of the zoomport
left float top-left corner longitude of the zoomport
right float bottom-right corner longitude of the zoomport
type string('ParkingLot'/'SecuredParking') the type of the parking we want to filter
range_km int search for a range using center_lat and center_lon for middle of viewport

If the type parameter is missing or different then the 2 possibilities, it returns all types of parkings.
If all of top, down, left and right are present, it filters by viewport, otherwise (at least one of 4 is missing) if both center_lat and center_lon are present it filters by range and if impartial params are given all parkings will be returned.

Response

Status Code: 200 if OK

{
  "parkings_in_range": [
    {
      "location": {
        "street": "George Baritiu",
        "point": {
          "latitude": "46.77262",
          "longitude": "23.586577"
        },
        "city": "Cluj-Napoca",
        "country": "Romania"
      },
      "id": 2,
      "name": "Heroes Parking",
      "free_spaces": 13,
      "occupied_spaces": 21,
      "unknown_spaces": 33,
      "is_favorite": true,
      "default_price": null,
      "all_spaces": 67,
      "admins": null,
      "features": null,
      "type": "ParkingLot",
      "zone": {
        "id": 2,
        "price": "1.0",
        "price_unit": "hour",
        "currency": "RON"
      }
    },
    {
      "location": {
        "street": "B-dul 1 Decembrie",
        "city": "Cluj-Napoca",
        "country": "Romania",
        "point": {
          "latitude": "46.770313811588",
          "longitude": "23.57314830645919"
        }
      },
      "id": 2161,
      "name": "1 DecembrieSP",
      "free_spaces": 1,
      "occupied_spaces": 2,
      "unknown_spaces": 0,
      "is_favorite": false,
      "default_price": "2.1",
      "all_spaces": 3,
      "admins": [
        2
      ],
      "features": {
        "booking_24h": false,
        "booking_barrier": true,
        "booking_camera": false,
        "booking_card": true,
        "booking_disabillity": false,
        "booking_garage": false
      },
      "type": "SecuredParking",
      "price_unit": "hour",
      "currency": "RON",
      "zone": null
    }
  ]
}

Explanation:

Parameter name Parameter type Description
location object object containing the location of the parking
id int id of the parking
name string name of the parking
free_spaces int number of free_spaces in the area
occupied_spaces int number of occupied_spaces in the area
unknown_spaces int number of unknown_spaces in the area
is_favorite bool true if parking is set as favorite by user
default_price null/string null if parking of type 'ParkingLot' or string representation of decimal value if type is 'SecuredParking'
all_spaces int total number of spaces in the area
admins null/list null if parking of type 'ParkingLot' or array of fo_user IDs which are owners or admins on the SecuredParking
features null/object null if parking of type 'ParkingLot' or object with boolean values for parking features
type string type of the parking
price_unit string time unit for default_price param, (hour/minute)
currency string currency used for the payments
zone null/object null if parking of type 'SecuredParking' or object with details of the zone

If the number of unknown_spaces == occupied_spaces + free_spaces then the icon for the area should be gray.

OR (if no parking areas in range)

{
    "parkings_in_range": []
}

Status Code: 401 if request not ok