The implementation of this app uses Python/Flask, with JSON as the database. The 'geopy' library was used for accurately calculating the “crow flies” distance between two sets of coordinates.
The API is live at https://scooter-reservation.herokuapp.com
View All Available Scooters
GET /
GET /view_all_available
None
Code : 200
Content : JSON list of objects, with each object containing the following properties:
Key
Data Type
Description of Value
id
string
The id of the scooter. This can be used to start and end reservations (see below).
lat
floating point
Latitude coordinate of the current location of the scooter.
lng
floating point
Longitude coordinate of the current location of the scooter.
is_reserved
boolean
Whether or not the scooter is currently reserved. Only unreserved scooters can be reserved.
Code : 422
Content : JSON object with a msg property that gives a brief description of the error trigger.
Parameter
Data Type Expected
Description
lat
floating point
Latitude coordinate of the desired location at which to reserve a scooter.
lng
floating point
Longitude coordinate of the desired location at which to reserve a scooter.
radius
integer/floating point
The radius of the search, i.e. The radius of the area around the desired location that is acceptable for reserving a scooter.
Code : 200
Content : JSON list of objects, with each object containing the following properties:
Key
Data Type
Description of Value
id
string
The id of the scooter. This can be used to start and end reservations (see below).
lat
floating point
Latitude coordinate of the current location of the scooter.
lng
floating point
Longitude coordinate of the current location of the scooter.
Code : 422
Content : JSON object with a msg property that gives a brief description of the error trigger.
Parameter
Data Type Expected
Description
id
string
The id of the scooter that is to be reserved. Go to search or view all available scooters to find out scooter IDs.
Code : 200
Content : JSON object with a msg property that gives a brief description of the successful operation.
Code : 422
Content : JSON object with a msg property that gives a brief description of the error trigger.
End Reservation for a Scooter
Parameter
Data Type Expected
Description
id
string
The id of the scooter whose reservation is to be ended. The scooter must have been reserved first in order to end a reservation.
lat
floating point
Latitude coordinate of the final location of the scooter where the trip is to be ended.
lng
floating point
Longitude coordinate of the final location of the scooter where the trip is to be ended.
Code : 200
Content : JSON object containing the following properties:
Parameter
Original Data Type
Description
msg
string
Short message a brief description of the successful operation
txn_id
string
The transaction ID / reference number associated with the successful payment transaction to be kept for the payee's records.
Code : 422
Content : JSON object with a msg property that gives a brief description of the error trigger.