Api Documentation - morenagit/wikiTest GitHub Wiki
Api Documentation
The pick a park project comes with built in REST API that offer a simple interface to the different types of users and devices.
Description
The following sequence diagram represent a high-level request and response data flow of our MEAN stack application. The client-side consists of the web application AngularJs client. However, this can be replaced by the mobile Android client or the parking spot device. In that case, the client would directly send RESTful API requests to the NodeJs server.
The next sequence diagram represents a request and response flow for a specific request. A parking company employee accesses the management web page, and the controller initializes itself, triggering a function to retrieve all the parking spots managed by the company. Then the controller calls the service function parkingComp.getParkings(user.company)
. Services expose functionalities to the controllers and increase modularity and reusability in our application. When the function is called, the corresponding RESTful api request is triggered. The NodeJs server handles the API request and response. The server handles these requests in an asynchronous and non-blocking way. When the query data has been retrieved, the callback function is invoked and the json response is returned to the client.
Methods
Drivers
- POST /driver-login - Driver login
- POST /driver - Driver registration
Web App users
- GET /users - Retrieve web app user data
- POST /login - Web app user login
- POST /users - Web app user registration
Companies
- GET /companies - Retrieve all companies data
- GET /companies:name - Retrieve specific company data
- POST /companies - Create a new company
- DELETE /companies - Delete a new company
Parkings
- GET /companies/:name/parkings - Retrieve all the parking spots of a parking company
- GET /companies/:name/parkings/:id - Retrieve a specific parking spot of a parking company
- POST /companies/:name/parkings - Create a new parking spot
- DELETE /companies/:name/parkings/:id - Delete a parking spot
- PATCH /companies/:name/parkings/:id - Updates properties of a parking spot
Bookings
- POST /companies/:name/bookings - Create a new booking for a parking spot
Stops
- GET /stops - Retrieve all the stops
- PATCH /stops/:id - Updates properties of a stop
Stops simulation
- POST /stops/start - Simulates driver arrival
- PATCH /stops/end - Simulates driver departure
Destination
- GET /destination - Retrieves a parking according to the driver's destination
Notices
- POST /notices - Creates a new notice