Skip to content

REST Api

Viktória Tibenská edited this page Dec 19, 2017 · 1 revision

REST Api

Getting Up And Running

Our project is using NodeJS so it is necessary to have it installed to get the project running. You can download it here. When you have it installed on your machine clone the project repository and from the root folder of the project run following commands.

mvn clean install
cd frontend
npm install
npm run dev
mvn tomcat7:run

The project is now running here and the base address for REST api is http://localhost:8080/pa165/rest

List Of Available Services

Hotel

To get a list of all hotels:

GET http://localhost:8080/pa165/rest/hotels

To get a hotel by its ID:

GET http://localhost:8080/pa165/rest/hotels/:id

To get rooms of a hotel by its ID:

GET http://localhost:8080/pa165/rest/hotels/room/:id

To create a new hotel (data in body):

POST http://localhost:8080/pa165/rest/hotels/create

To delete hotel by its ID:

DELETE http://localhost:8080/pa165/rest/hotels/:id

User

To get a list of all users:

GET http://localhost:8080/pa165/rest/users

To get user by id:

GET http://localhost:8080/pa165/rest/users/:id

To register a user (data in body):

GET http://localhost:8080/pa165/rest/users/register

To find user by e-mail:

GET http://localhost:8080/pa165/rest/users/mail/:mail

To log in or authenticate user (data in body):

POST http://localhost:8080/pa165/rest/users/auth

To check whether user is admin (data in body):

POST http://localhost:8080/pa165/rest/users/admin

Reservation

To get a list of all reservations:

GET http://localhost:8080/pa165/rest/reservations

To get a reservation by its ID:

GET http://localhost:8080/pa165/rest/reservations/:id

To create a new reservation (data in body):

POST http://localhost:8080/pa165/rest/reservations/create

To delete reservation by its ID:

DELETE http://localhost:8080/pa165/rest/reservations/:id
Clone this wiki locally